The problem I have is to do with generating large reports. I am doing so using the prawn gem to got results however I was wondering if this could be migrated to a background process.
Since I am using faye for push notifications and sidekiq for background tasks, a potential solution would be to generate the report in a sidekiq worker and use faye to notify the client of the completion of the worker. The issue with this is I don't see a way of cleaning up the generated file elegantly. I don't think generating the file within the controller action is feasible as it leads to unreasonable loading times and blocks other requests.
Is this system possible? Or am I thinking about this in the wrong way?
You are right, this is a perfectly valid to do things.
I am not sure what you means about "cleaning up the generated file". If you mean deleting from the file system, you could do it in the controller who download it, and eventually add a daily cron job who remove all remaining files.
We used such system in various projects.
Another option if the generation is really long is to send an email (if you got it) once the report is generated with the report embedded or with a link to it.