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

Increasing block delay #513

Open
przmyst opened this issue Jan 18, 2025 · 1 comment
Open

Increasing block delay #513

przmyst opened this issue Jan 18, 2025 · 1 comment

Comments

@przmyst
Copy link

przmyst commented Jan 18, 2025

While subscribing to blocks the delay between blocks received increases as the program runs. How could I keep real-time sync with blocks?

Delays:
1122
1896
1570
2362
2147
2840
3500
3065
3912
3615
4262
3948
4929
4688
5342
5995
5340

const Yellowstone = require('@triton-one/yellowstone-grpc').default

;(async () => {

	const client = new Yellowstone(
		'',
		'',
		{
			'grpc.max_receive_message_length': 64 * 1024 * 1024
		})

	const stream = await client.subscribe()

	stream.on('data', (data) => {
		if(data && data.block) {
			//How far behind are we?
			console.log(Date.now() - data.block.blockTime.timestamp*1000)
		}
	})

	stream.on('error', console.log)

	const request ={
		slots: {
		},
		transactions: {
		},
		commitment: 'finalized',
		accounts: {
		},
		transactionsStatus: {
		},
		entry: {
		},
		blocks: {
			client: {
				accountInclude: [],
				includeTransactions: true,
				includeAccounts: false,
				includeEntries: false
			}
		},
		blocksMeta: {
		},
		accountsDataSlice: []
	}

	stream.write(request, (err) => {
		if(err) console.log(err)
	})

})()

@fanatid
Copy link
Collaborator

fanatid commented Jan 19, 2025

it looks like you can't ingest fast enough due to network latency or cpu intensive code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants