Hey everyone!
I’m working with Weaviate using a multi-tenancy collection with autoTenantActivation set to true. Now, I need to manage the activityStatus of a tenant, more specifically, I want to automatically set a tenant’s activityStatus to INACTIVE after a period of inactivity.
Given this setup, does anyone have experience or suggestions on how to implement this? I’m thinking of using a scheduler to periodically check and update the tenant’s status, but I’m curious if there are any best practices or existing solutions for handling this scenario.
Thanks in advance!
Hello @VasylHerman,
Welcome to our Weaviate community and it’s great to have you here .
I actually like your solid approach! Using a scheduler to periodically check for tenant inactivity and update the activityStatus
to INACTIVE
is definitely a good solution. Additionally, a fixed time would work as if no interactivity with tenant, set them to WARM, followed by a condition setting them to Offload once a certain criteria is met with no activity at all.
Here’s how you could plan it:
-
You can use a scheduler (like cron
or APScheduler
in Python to run a job at regular intervals. This job would check the last activity timestamp of each tenant.
-
For each tenant, compare the last activity timestamp with the current time. If the difference exceeds your defined conditions, set the tenant to WARM follow/or OFFLOAD.
-
Activate tenant back as per your software logic and business goals.
If you’re using the autoTenantActivation feature, tenants will automatically become active again when they’re accessed, so the above steps should work well with that.
Here is how to work with Tenant activation from our docs:
Hope this helps! Let me know if you have any more questions.