citusdata / citusdata/activerecord-multi-tenant

Possible to lazily load tenant in sidekiq middleware?

Open
#235 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
759
Forks
113
PR merge metrics
No merged PRs in 30d

Description

First, thanks for such a useful gem!

We have a setup where we run a *lot* of sidekiq jobs using the middleware from this gem. They are all tenant-scoped, but a lot of them never actually need the tenant object itself, just the ID (to attach as a `where` clause to other queries).

We have found that our database is doing a fair bit of extra work loading the tenant object in all of these jobs (not because the query is expensive, but because of the volume of jobs we run), which is ultimately unused. We were hoping there was a way to make the sidekiq middleware load the tenant object lazily? Or the ability to flag jobs as not needing the full object, and just using the ID from the job args (in the way that `MultiTenant.with(id)` is already supported) or something?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.