Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

format #29

Merged
merged 1 commit into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export async function action(options: WebhookRunOptions) {
const finalBlocksOnly = boolean.parse(options.finalBlocksOnly);

// Block Emitter
const { emitter, moduleHash } = await setup({...options, cursor});
const { emitter, moduleHash } = await setup({ ...options, cursor });

// Queue
const queue = new PQueue({ concurrency: 1 }); // all messages are sent in block order, no need to parallelize
Expand Down Expand Up @@ -80,5 +80,3 @@ export async function action(options: WebhookRunOptions) {
http.server.close();
});
}


7 changes: 4 additions & 3 deletions src/postWebhook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,18 @@ function now() {
}

let blocks = 0;
let start = now();
const start = now();
// let lastUpdate = now();

// TO-DO replace with Prometheus metrics
function logProgress(metadata?: Metadata) {
if ( !metadata ) return;
if (!metadata) return;
const delta = now() - start;
const rate = Math.round(blocks / delta);
const minutes = Math.round(delta / 60);
const seconds = delta % 60;
if ( blocks ) logUpdate(`[app] timestamp=${metadata.clock.timestamp} block_number=${metadata.clock.number} blocks=${blocks} [${rate} b/s] (${minutes}m ${seconds}s)`);
if (blocks)
logUpdate(`[app] timestamp=${metadata.clock.timestamp} block_number=${metadata.clock.number} blocks=${blocks} [${rate} b/s] (${minutes}m ${seconds}s)`);
blocks++;
}

Expand Down
Loading