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

Don't hang in createHistoryStream() when blocks are not available #167

Open
josephmturner opened this issue Oct 31, 2024 · 0 comments · May be fixed by #168
Open

Don't hang in createHistoryStream() when blocks are not available #167

josephmturner opened this issue Oct 31, 2024 · 0 comments · May be fixed by #168

Comments

@josephmturner
Copy link

createHistoryStream currently hangs when blocks are not available. I would like to iterate over the full history of a hyperbee which is not fully replicated. Could createHistoryStream() accept a { wait: false } argument to make it keeping loop when it encounters BLOCK_NOT_AVAILABLE? Perhaps this API could be used like this:

for await (const entry of db.createHistoryStream({ wait: false })) {
  if (entry.type = 'put') handlePut()
  if (entry.type = 'del') handleDel()
  if (entry.type = 'BLOCK_NOT_AVAILABLE') handleMissingBlock()
}
@josephmturner josephmturner changed the title Improve createHistoryStream() behavior when blocks are not available Don't hang in createHistoryStream() when blocks are not available Oct 31, 2024
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

Successfully merging a pull request may close this issue.

1 participant