Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Support for background jobs? #167
Uploading directly to s3 is great, but the copy from the cache to store is still done inline (even the s3 copy command can be pretty slow). I'm trying to find the best way to background this process with ActiveJob so that the cache -> store transfer can be deferred while the image is stored from the cache.
My original idea was to make a backend that wraps another backend, deferring all methods to the wrapped backend except for upload/delete, which it would override to enqueue the worker.
The problem is that most of the work (uploading cache -> store, deleting from cache, updating model) is done by the attacher, not by the backend. Also, the backend doesn't really have any context on what record it is working for, so there is no way to enqueue anything that will know what to do after popping out of Redis.
Any ideas on how this could done? I don't mind making a PR but I'm not really sure where to begin.
Hmm... correct me if I'm wrong, but if the
If we could specify an adapter for the attacher as well as the backend, then this might be a little easier? Then there could be a subclass of
Hi @mskog that is my gem but it is certainly not ready for production yet. Mostly I just have it there for experimentation, you are welcome to fork or contribute though. I am using it in a side project and haven't had any major issues so far. I would like to add tests to it of course... we all know how it goes.