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

timings for event loop #15

Merged
merged 2 commits into from
Jul 12, 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
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ BEGIN
v.record_type,
v.record_data,
v.tags,
v.updated_at,
following_info.is_following,
following_info.is_blocked,
following_info.is_muted
Expand Down
2 changes: 1 addition & 1 deletion src/pubsub/publisher/contract-event-publisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class ContractEventPublisher implements EventPublisher {
let i = 0
const logs: Log[] = []
for (const eventSignature of eventSignatures) {
await sleep(2_500)
await sleep(500)
console.log(
`Fetching historical logs for ${this.contractName} ${eventSignature} (${++i}/${eventSignatures.length})`
)
Expand Down
2 changes: 2 additions & 0 deletions src/pubsub/publisher/event-interleaver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import BinaryHeap from 'heap-js'
import { logger } from '#/logger'
import { type Event, compareEvents } from '#/pubsub/event'
import type { EventSubscriber } from '#/pubsub/subscriber/interface'
import { sleep } from '#/utilities/index'
import type { EventPublisher } from './interface'

type ReceivedEvent = {
Expand Down Expand Up @@ -165,6 +166,7 @@ export class EventInterleaver implements EventPublisher, EventSubscriber {
await this.#propagateBatch(batch)
batch = []
}
await sleep(1000)
}

// Propagate any remaining events in the last batch
Expand Down