| 2104 | * operation — so the diagnostic points at the store rather than at whatever the |
| 2105 | * caller happened to be doing. */ |
| 2106 | const boundedCall = <A>( |
| 2107 | effect: Effect.Effect<A, StorageFailure>, |
| 2108 | key: string, |
| 2109 | operation: string, |
| 2110 | ): Effect.Effect<A, StorageFailure> => |
| 2111 | effect.pipe( |
| 2112 | Effect.timeoutOrElse({ |
| 2113 | duration: Duration.millis(CREDENTIAL_PROVIDER_TIMEOUT_MS), |
| 2114 | orElse: () => |
| 2115 | Effect.fail( |
| 2116 | new StorageError({ |
| 2117 | message: |
| 2118 | `Credential provider "${key}" did not answer ${operation} within ` + |
| 2119 | `${CREDENTIAL_PROVIDER_TIMEOUT_MS}ms. The store is unreachable or not responding; ` + |
| 2120 | `the credential was not resolved.`, |
| 2121 | cause: undefined, |
| 2122 | }), |
| 2123 | ), |
| 2124 | }), |
| 2125 | ); |
| 2126 | |
| 2127 | /** Wrap a provider so every call it exposes is bounded. |
| 2128 | * |