SpacetimeDB
SpacetimeDB copied to clipboard
Views: cleanup unsubscribed views
Description of Changes
A tokio task to cleanup unsubscribed views. fixes #3587
API and ABI breaking changes
NA
Expected complexity level and risk
2
Testing
Added a test
Test is better modularised in this PR - https://github.com/clockworklabs/SpacetimeDB/pull/3670.
- Also we probably want to bound the length of time a cleanup job takes. If there are many old views, I think we'd rather clean them up in multiple jobs to avoid taking a tx lock for an extended period of time.
Should it be limited by a hardcoded number (like 100 cleanups at a time) Or duration (atmost to take 5ms) or something else?
I feel limiting it to hardcoded number of views to cleanup can be a problem if continously more new views expires more than that number between job intervals.
I agree, I think duration is the right metric. And we can even make that duration configurable later (not a requirement for this PR).