Where to add 'always running' thread to Yesod applications

非 Y 不嫁゛ 提交于 2019-12-06 09:16:23

You should put it in the makeApplication function in the scaffolded Application.hs file.

This function will run once for every instance of your web application that is started1, and since you almost always only run one instance of your application, this is the place that you should do it.

1Note that it theoretically is possible to run multiple instances of the same WAI application in the same process, e.g. if you want two instances that listen on different ports, but by default this will never happen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!