(url: string)
| 552 | }; |
| 553 | |
| 554 | export const waitUntilUrlIsNotResponding = async (url: string) => { |
| 555 | const maxRetries = 30; |
| 556 | const retryIntervalMs = 1000; |
| 557 | let retries = 0; |
| 558 | |
| 559 | const axiosInstance = API.getAxiosInstance(); |
| 560 | while (retries < maxRetries) { |
| 561 | try { |
| 562 | await axiosInstance.get(url); |
| 563 | } catch { |
| 564 | return; |
| 565 | } |
| 566 | |
| 567 | retries++; |
| 568 | await new Promise((resolve) => setTimeout(resolve, retryIntervalMs)); |
| 569 | } |
| 570 | throw new Error( |
| 571 | `URL ${url} is still responding after ${maxRetries * retryIntervalMs}ms`, |
| 572 | ); |
| 573 | }; |
| 574 | |
| 575 | // Allows users to more easily define properties they want for agents and resources! |
| 576 | type RecursivePartial<T> = { |
no test coverage detected