Skip to content

Commit

Permalink
[Ingest Manager] Fix polling for new agent action (#77339)
Browse files Browse the repository at this point in the history
  • Loading branch information
nchaulet authored Sep 14, 2020
1 parent 65b5f94 commit 0fb4895
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,15 @@ function getInternalUserSOClient() {
}

function createNewActionsSharedObservable(): Observable<AgentAction[]> {
const internalSOClient = getInternalUserSOClient();
let lastTimestamp = new Date().toISOString();

return timer(0, AGENT_UPDATE_ACTIONS_INTERVAL_MS).pipe(
switchMap(() => {
return from(getNewActionsSince(internalSOClient, new Date().toISOString()));
const internalSOClient = getInternalUserSOClient();

const timestamp = lastTimestamp;
lastTimestamp = new Date().toISOString();
return from(getNewActionsSince(internalSOClient, timestamp));
}),
shareReplay({ refCount: true, bufferSize: 1 })
);
Expand Down

0 comments on commit 0fb4895

Please sign in to comment.