Am 3 days new to Vapor, so pardon what may be a beginner question.
I am bringing a Swift command line app to Vapor, for which part of the work it does is repeating.
In the boot function, I call a method which in turn calls app.eventLoop.scheduleRepeatedTask(initialDelay:delay:)
In the method passed to scheduleRepeatedTask I execute a
session.dataTask(with: request) { (data, response, error) in...
I get the result back in the closure and can successfully parse it via Codable, but when I then try to process the parsed object I get a SIGABRT due to simultaneous access.
I imagine I need to turn the session.dataTask into a promise/futre instead, but I'm not finding any examples how to do that. Would appreciate any links. I've read through the docs.vapor.codes section on async, but still not clear from a high level how to approach the problem.
TIA.