Skip to main content

Method returns true in a rails app controller, but returns false in resque worker when File.exists?

Rails • Asked by SarikaA

I want to pass the path this to a resque worker which will act upon this file. This worker is unable to find this file and the File.exists? Return a false even though the same method returns true in the controller class. This is happening intermittently and I assume there is a race condition. Any suggestions as to what could be the issue and how to handle it?

Please give me some advice...

Thanks in advance.


Try running your worker behind an after_commit callback. It might be because your worker started running even if the data hasn't persisted in your DB yet.


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 22,346+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.