Clear materialized view tables async
When clients unsubscribe or disconnect, we update the st_view_sub system table, but we don't clear the backing table or read sets. We should have an async task that does this cleanup periodically.
Is it neccessary to do it asynchoronously? Can we not do it within same transaction in which unsuscribe_view happens?
@Shubham8287 Doing it synchronously would require a larger refactor, since views are evaluated using a mutable transaction whereas unsubscribes use read-only transactions.
@Shubham8287 Doing it synchronously would require a larger refactor, since views are evaluated using a mutable transaction whereas unsubscribes use read-only transactions.
Umm, it is working with mutable transactions - https://github.dev/clockworklabs/SpacetimeDB/blob/e0b8e6f2654c9c67f0cbb11334de31434949adfc/crates/core/src/subscription/module_subscription_actor.rs#L1035.
Are you talking about somewhere else?