Skip to content

Possible to lazily load tenant in sidekiq middleware? #235

@eapache-opslevel

Description

@eapache-opslevel

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions