fix(utils): use smartdelay.Timeout for cancellable timeouts and call timeout.cancel() on cleanup; add @git.zone/cli release configuration pointing to Verdaccio registry with public access
This commit is contained in:
@@ -12,24 +12,16 @@ export function createTimeoutController(timeoutMs: number): {
|
||||
cleanup: () => void;
|
||||
} {
|
||||
const controller = new AbortController();
|
||||
let timeoutId: any;
|
||||
|
||||
// Set up timeout
|
||||
plugins.smartdelay
|
||||
.delayFor(timeoutMs)
|
||||
.then(() => {
|
||||
controller.abort();
|
||||
})
|
||||
.then((result) => {
|
||||
timeoutId = result;
|
||||
});
|
||||
// Use Timeout directly so we can cancel it when the fetch completes
|
||||
const timeout = new plugins.smartdelay.Timeout(timeoutMs, null);
|
||||
timeout.promise.then(() => {
|
||||
controller.abort();
|
||||
});
|
||||
|
||||
// Cleanup function to clear timeout
|
||||
// Cleanup function to cancel the timeout timer
|
||||
const cleanup = () => {
|
||||
if (timeoutId !== undefined) {
|
||||
// smartdelay doesn't expose a cancel method, so we just ensure
|
||||
// the controller won't abort if already completed
|
||||
}
|
||||
timeout.cancel();
|
||||
};
|
||||
|
||||
return { controller, cleanup };
|
||||
|
||||
Reference in New Issue
Block a user