mirror of
https://github.com/samuelthomas2774/nxapi.git
synced 2026-08-20 17:45:10 -05:00
Send events for errors to prevent connection timeouts
This commit is contained in:
@@ -560,6 +560,11 @@ class Server extends HttpServer {
|
||||
const retry_after = err.response.headers.get('Retry-After');
|
||||
|
||||
if (retry_after && /^\d+$/.test(retry_after)) {
|
||||
stream.sendEvent(null, 'debug: timestamp ' + new Date().toISOString(), {
|
||||
error: err,
|
||||
error_message: (err as Error).message,
|
||||
});
|
||||
|
||||
await new Promise(rs => setTimeout(rs, parseInt(retry_after) * 1000));
|
||||
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user