I have a Play 2.x app up and running on Heroku with a single web dyno.
On startup, an Akka actor is triggered which itself schedules future jobs (e.g. sending push notifications).
object Global extends GlobalSettings {
override def onStart(app:Application) {
val actor = Akka.system.actorOf(Props[SomeActor])
Akka.system.scheduler.scheduleOnce(0 seconds, actor, None)
}
}
This works fine with one web dyno but I am curious to know what happens if I turn up the number of web dynos. Will onStart be executed twice with two web dynos?
Would be great if Global really works globally and onStart is only executed once, independently of the number of web dynos. If not, multiple dynos have to somehow agree on one dyno responsible for doing the job.
Did anybody run into a similar issue?