request_store-sidekiq icon indicating copy to clipboard operation
request_store-sidekiq copied to clipboard

Persist the RequestStore at job execution

Open cyrill62 opened this issue 7 years ago • 4 comments

If the persist feature is active:

RequestStore::Sidekiq.configure do |config|
  # Enable store persistance a job execution.
  config.persist = true
end

The RequestStore.store is saved and restored at job execution.

It allows you to save the store for retried jobs or keep the same store for jobs pushed by another job with a store.

cyrill62 avatar Aug 09 '18 13:08 cyrill62

This is nice.

(I'm not 100% sure but) one additional thing I'd need before I could use this is a way to strip the serialized RequestStore of certain complex objects that might not be serializable; I know I've run into cases where some 3rd party gem checks for the existence of RequestStore and then adds an object that can't be serialized to JSON because of some cyclical data structure.

machty avatar Sep 10 '18 23:09 machty

Perhaps we can serialize the store in the middleware, then skip not serializable objects.

I'll write a test to reproduce this case.

cyrill62 avatar Sep 18 '18 11:09 cyrill62

@cyrill62 Hi, do you have any intention moving this forward? :)

Laykou avatar Jun 01 '20 21:06 Laykou

Super late to the party here 🎉 but is there anything new on this that I should be aware of. First off, it's gorgeous code and I can see the need and use case for this, so even with the limitation outlined with cyclical objects I'd be inclined to include and release.

Curious if @cyrill62, have you used this in production on a fork without issues, have more to commit here, etc?

Thanks for all the hard work!

macfanatic avatar Sep 02 '21 19:09 macfanatic