I have a Rails application that has a Document
with the flag available
. The document is uploaded to an external server where it is not immediately available (takes time to propogate). What I'd like to do is poll the availability and update the model when available.
I'm looking for the most performant solution for this process (service does not offer callbacks):
Document
is uploaded to app- app uploads to external server
- app polls url (http://external.server.com/document.pdf) until available
- app updates model Document.available = true
I'm stuck on 3. I'm already using sidekiq in my project. Is that an option, or should I use a completely different approach (cron job).
Documents
will be uploaded all the time and so it seems relevant to first poll the database/redis to check for Documents
which are not available.