Skip to content

Commit

Permalink
chore: add meta to rxjs timeout errors (#1683)
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Glastra <timo@animo.id>
  • Loading branch information
TimoGlastra committed Dec 28, 2023
1 parent 1f781ec commit b28902c
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,10 @@ export class ConnectionService {
filterContextCorrelationId(agentContext.contextCorrelationId),
map((e) => e.payload.connectionRecord),
first(isConnected), // Do not wait for longer than specified timeout
timeout(timeoutMs)
timeout({
first: timeoutMs,
meta: 'ConnectionService.returnWhenIsConnected',
})
)
.subscribe(subject)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@ export class DiscoverFeaturesApi<
// Return disclosures
map((e) => e.payload.disclosures),
// If we don't have an answer in timeoutMs miliseconds (no response, not supported, etc...) error
timeout(options.awaitDisclosuresTimeoutMs ?? 7000), // TODO: Harmonize default timeouts across the framework
timeout({
first: options.awaitDisclosuresTimeoutMs ?? 7000,
meta: 'DiscoverFeaturesApi.queryFeatures',
}), // TODO: Harmonize default timeouts across the framework
// We want to return false if an error occurred
catchError(() => of([]))
)
Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/modules/oob/OutOfBandApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,10 @@ export class OutOfBandApi {
),
// If the event is found, we return the value true
map(() => true),
timeout(15000),
timeout({
first: 15000,
meta: 'OutOfBandApi.handleHandshakeReuse',
}),
// If timeout is reached, we return false
catchError(() => of(false))
)
Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/modules/routing/MediationRecipientApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,10 @@ export class MediationRecipientApi {
// Only wait for first event that matches the criteria
first(),
// Do not wait for longer than specified timeout
timeout(timeoutMs)
timeout({
first: timeoutMs,
meta: 'MediationRecipientApi.requestAndAwaitGrant',
})
)
.subscribe(subject)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,10 @@ export class MediationRecipientService {
// Only wait for first event that matches the criteria
first(),
// Do not wait for longer than specified timeout
timeout(timeoutMs)
timeout({
first: timeoutMs,
meta: 'MediationRecipientService.keylistUpdateAndAwait',
})
)
.subscribe(subject)

Expand Down

0 comments on commit b28902c

Please sign in to comment.