Reputation: 110960
Does using heroku restart
result in data loss? Is the last DB backup used during a restart or is the DB unaffected?
Upvotes: 3
Views: 4012
Reputation: 11395
A restart does not affect the database. So, generally speaking, data loss will not occur on restart.
However, it will also restart your workers, which may interrupt any jobs currently being processed. This can result in a partially finished job, which may have an undesired effect, depending on the job. You should design any background jobs so they can be restarted from scratch if necessary (for instance, do any database interaction in a transaction).
A similar effect is also possible for your dynos - in this case, instead of a partially completed job, it would be a partially completed web request. This would very rarely cause a problem, though.
A deploy - but not necessarily a restart - will also cause any files in your temporary directories (tmp/
and log/
) to be deleted.
To prevent both of these, use maintenance mode (heroku maintenance on
) and make sure all your workers and web requests are done working before you deploy or restart.
Upvotes: 6