mirror of
https://github.com/urbit/shrub.git
synced 2025-01-01 17:16:47 +03:00
@urbit/http-api: fix ack debouncing
This commit is contained in:
parent
06f82bfbae
commit
b1b9bc01e8
@ -269,6 +269,12 @@ export class Urbit {
|
||||
this.abort.abort();
|
||||
this.abort = new AbortController();
|
||||
this.uid = `${Math.floor(Date.now() / 1000)}-${hexString(6)}`;
|
||||
if(this.debounceTimer) {
|
||||
clearTimeout(this.debounceTimer);
|
||||
this.debounceTimer = null;
|
||||
}
|
||||
this.calm = true;
|
||||
this.outstandingJSON = [];
|
||||
this.lastEventId = 0;
|
||||
this.lastAcknowledgedEventId = 0;
|
||||
this.outstandingSubscriptions = new Map();
|
||||
@ -321,7 +327,7 @@ export class Urbit {
|
||||
|
||||
private outstandingJSON: Message[] = [];
|
||||
|
||||
private debounceTimer: any = null;
|
||||
private debounceTimer: NodeJS.Timeout = null;
|
||||
private debounceInterval = 500;
|
||||
private calm = true;
|
||||
|
||||
@ -350,6 +356,7 @@ export class Urbit {
|
||||
body
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
json.forEach(failed => this.outstandingJSON.push(failed));
|
||||
if (this.onError) {
|
||||
this.onError(error);
|
||||
|
Loading…
Reference in New Issue
Block a user