Check realtime mode in remote clock interceptor (#6985)

* Revert Date.now() purge change
Check that the request is using realtime before using the remote-clock start and end timestamps for telemetry requests
* docs: clarify comment

---------

Co-authored-by: Jesse Mazzella <ozyx@users.noreply.github.com>
This commit is contained in:
Shefali Joshi 2023-10-03 13:41:02 -07:00 committed by GitHub
parent d53d8d562e
commit ce59c0f50a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,10 +31,16 @@ function remoteClockRequestInterceptor(openmct, _remoteClockIdentifier, waitForB
return activeClock?.key === 'remote-clock' && !remoteClockLoaded;
},
invoke: async (request) => {
const { start, end } = await waitForBounds();
remoteClockLoaded = true;
request.start = start;
request.end = end;
const timeContext = request?.timeContext ?? openmct.time;
// Wait for initial bounds if the request is for real-time data.
// Otherwise, use the bounds provided by the request.
if (timeContext.isRealTime()) {
const { start, end } = await waitForBounds();
remoteClockLoaded = true;
request.start = start;
request.end = end;
}
return request;
}