Can I use timer, such as NSTimer
in Vapor (server-side Swift)?
I hope my server written in Vapor can do some tasks proactively once in a while. For example, polling some data from the web every 15 mins.
How to achieve this with Vapor?
If you can accept your task timer being re-set whenever the server instance is recreated, and you only have one server instance, then you should consider the excellent Jobs library.
If you need your task to run exactly at the same time regardless of the server process, then use cron
or similar to schedule a Command.