Play 2 Heroku startup with multiple dynos

前端 未结 2 1839
余生分开走
余生分开走 2021-01-01 05:36

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 n

2条回答
  •  情歌与酒
    2021-01-01 06:09

    You can also get dyno name at runtime:

    String dyno = System.getenv("DYNO");
    

    so doing a check like this may also work:

    if(dyno.equals("web.1")) {
    
    }
    

提交回复
热议问题