Skip to content

Commit

Permalink
add .once
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisCarriere committed Aug 2, 2023
1 parent bba4e3f commit 5dc8ece
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
},
"dependencies": {
"@substreams/core": "^0.1.18",
"@substreams/manifest": "^0.0.4",
"@substreams/node": "^0.1.4",
"@substreams/manifest": "^0.0.8",
"@substreams/node": "^0.2.0",
"commander": "latest",
"dotenv": "latest",
"node-fetch": "^3.3.2",
Expand Down
5 changes: 1 addition & 4 deletions src/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,8 @@ export async function setup(options: RunOptions) {

// Restart on inactivity
// only activate once first cursor is received
let isStarted = false;
emitter.on("cursor", () => {
if ( isStarted ) return;
emitter.once("cursor", () => {
onRestartInactivitySeconds(emitter, options.restartInactivitySeconds);
isStarted = true;
});

return { emitter, substreamPackage, moduleHash, startCursor };
Expand Down

0 comments on commit 5dc8ece

Please sign in to comment.