Skip to content

Conversation

carlopi
Copy link
Collaborator

@carlopi carlopi commented Jan 22, 2025

Main note is that this allows while busy executing (and so no messages can be received by the worker) messages can still be sent to the main/UI thread.

Missing:

  • Add a demo/test

@carlopi carlopi changed the base branch from v1.2-histrionicus to main March 17, 2025 12:56
@domoritz
Copy link
Collaborator

Nice. Instead of a callback, would it be possible to use a stream https://developer.mozilla.org/en-US/docs/Web/API/Streams_API?

@carlopi
Copy link
Collaborator Author

carlopi commented Mar 17, 2025

@domoritz: thanks for taking a look, nice observation.

I would think that here a 1-way only message via the callback is OK here, and should allow this to be driven by actual progress, but I think I might be missing something, could you expand on how do you see this working?

@carlopi
Copy link
Collaborator Author

carlopi commented Mar 17, 2025

I would be for merging this, this is still experimental, can always be fiddle with, but I would be interested in your idea.

@carlopi carlopi merged commit b1453c5 into duckdb:main Mar 17, 2025
15 checks passed
@domoritz
Copy link
Collaborator

A readable stream could update the progress. It could look like the random number stream in https://dev.to/ruben_alapont/stream-your-way-creating-custom-streams-395o. A stream is very similar to a js iterator but it can push updates rather than the consumer pulling/iterating.

My question is mainly about API. Callbacks are somewhat older way of doing this in js and these days async, promises, streams, iterators, etc are the way to go.

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 this pull request may close these issues.

2 participants