Skip to content

Commit

Permalink
Merge pull request AdaptiveConsulting#2291 from AdaptiveConsulting/fi…
Browse files Browse the repository at this point in the history
…x/5589-fix-the-fix-start-sow

fix: credit start sow, restore reset on re-connect
  • Loading branch information
algreasley authored Sep 28, 2023
2 parents ba65b01 + 49a6adc commit 007ef8c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions packages/client/src/services/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const connectionMapper = (input: HConnectionStatus): ConnectionStatus =>
// Stream of mapped (Hydra - RT) connection status
const mappedConnectionStatus$ = hConnectionStatus$().pipe(map(connectionMapper))

const IDLE_TIMEOUT = 15 * 60000
const IDLE_TIMEOUT_MINUTES = 15

// Dispose of connection and emit when idle for IDLE_TIMEOUT ms
const idleDisconnect$: Observable<ConnectionStatus> = combineLatest([
Expand All @@ -84,9 +84,11 @@ const idleDisconnect$: Observable<ConnectionStatus> = combineLatest([
// Only when we are connecting/ed and there is a disposable
connectionExists(status, dispose),
),
debounceTime(IDLE_TIMEOUT),
debounceTime(IDLE_TIMEOUT_MINUTES * 60000),
map(([[, dispose]]) => {
console.log(`User was idle for ${IDLE_TIMEOUT}, disconnecting`)
console.log(
`User was idle for ${IDLE_TIMEOUT_MINUTES} minutes .. disconnecting`,
)
dispose()
connectionDisposable$.next(() => undefined)
return ConnectionStatus.IDLE_DISCONNECTED
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/services/credit/creditRfqs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const creditRfqsById$ = creditRfqUpdates$.pipe(
switch (update.type) {
case START_OF_STATE_OF_THE_WORLD_RFQ_UPDATE:
// init state of scan is correct for start of SoW
return acc
return [false, {}]
case END_OF_STATE_OF_THE_WORLD_RFQ_UPDATE:
return [true, rfqs]
case RFQ_CREATED_RFQ_UPDATE:
Expand Down

0 comments on commit 007ef8c

Please sign in to comment.