mirror of
https://github.com/urbit/shrub.git
synced 2024-12-20 01:01:37 +03:00
eventsource: prevent resetting event id counter
This commit is contained in:
parent
421eef1d19
commit
e5b66e3484
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@urbit/http-api",
|
"name": "@urbit/http-api",
|
||||||
"version": "2.1.0",
|
"version": "2.1.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"description": "Library to interact with an Urbit ship over HTTP",
|
"description": "Library to interact with an Urbit ship over HTTP",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -235,9 +235,9 @@ export class Urbit {
|
|||||||
console.log('Received SSE: ', event);
|
console.log('Received SSE: ', event);
|
||||||
}
|
}
|
||||||
if (!event.id) return;
|
if (!event.id) return;
|
||||||
this.lastEventId = parseInt(event.id, 10);
|
const eventId = parseInt(event.id, 10);
|
||||||
if (this.lastEventId - this.lastAcknowledgedEventId > 20) {
|
if (eventId - this.lastAcknowledgedEventId > 20) {
|
||||||
this.ack(this.lastEventId);
|
this.ack(eventId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.data && JSON.parse(event.data)) {
|
if (event.data && JSON.parse(event.data)) {
|
||||||
@ -312,7 +312,7 @@ export class Urbit {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
reset() {
|
reset() {
|
||||||
if(this.verbose) {
|
if (this.verbose) {
|
||||||
console.log('resetting');
|
console.log('resetting');
|
||||||
}
|
}
|
||||||
this.delete();
|
this.delete();
|
||||||
|
Loading…
Reference in New Issue
Block a user