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

Run the receive-queue workers without bindings #709

Merged
merged 2 commits into from
Jan 14, 2025
Merged

Conversation

dwwoelfel
Copy link
Contributor

@dwwoelfel dwwoelfel commented Jan 14, 2025

I noticed that our traces for invalidator/work were including a lot of extra spans past the end of the top-level trace. This happens because we start the worker in an on-add callback to grouped-queue/put!, so it was inheriting the parent span from the bindings.

Now we have a new type of virtual future that doesn't propagate bindings. That gives our workers a bit more isolation. I also gave them their own virtual thread executor--doesn't do much now, but it would let us more thoroughly "shutdown" a grouped-queue in the future.

Much easier to review with whitespace off: https://github.com/instantdb/instant/pull/709/files?w=1

Copy link

View Vercel preview at instant-www-js-worker-vfuture-jsv.vercel.app.

Copy link
Contributor

@stopachka stopachka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!!

:attributes {:workset-count (count workset)
:total total-items
:worker-count ((:get-worker-count @gq))}})
(clojure.tools.logging/info {:name "workset"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: is this intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's just a function for testing (it's in a comment block) and I didn't want to overload honeycomb with debug traces.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, makes sense! 🫡

@dwwoelfel dwwoelfel merged commit a970c83 into main Jan 14, 2025
27 checks passed
@dwwoelfel dwwoelfel deleted the worker-vfuture branch January 14, 2025 17:34
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