I am trying to do something like have an api as well as a scheduled function run in the same package/main wherein certain actions would be done on a periodic basis like let’s say generate certain struct data by fetching data from DB and hit another API outside of it using a generated unique request ID. It also has an API server of it’s own which would obtain data back from the other service where it would get certain data with the request ID for mapping/reference.
Can I do this using 2 go routines with a waitgroup to control how they run?
Any good way to run cronjobs in this fashion? Thanks.