mirror of
https://github.com/simon987/task_tracker.git
synced 2025-12-11 14:08:52 +00:00
bugfix + reset timed out tasks
This commit is contained in:
10
api/main.go
10
api/main.go
@@ -40,13 +40,19 @@ func Index(r *Request) {
|
||||
func (api *WebAPI) setupMonitoring() {
|
||||
|
||||
api.Cron = cron.New()
|
||||
schedule := cron.Every(config.Cfg.MonitoringInterval)
|
||||
api.Cron.Schedule(schedule, cron.FuncJob(api.Database.MakeProjectSnapshots))
|
||||
monSchedule := cron.Every(config.Cfg.MonitoringInterval)
|
||||
api.Cron.Schedule(monSchedule, cron.FuncJob(api.Database.MakeProjectSnapshots))
|
||||
|
||||
timeoutSchedule := cron.Every(config.Cfg.ResetTimedOutTasksInterval)
|
||||
api.Cron.Schedule(timeoutSchedule, cron.FuncJob(api.Database.ResetTimedOutTasks))
|
||||
api.Cron.Start()
|
||||
|
||||
logrus.WithFields(logrus.Fields{
|
||||
"every": config.Cfg.MonitoringInterval.String(),
|
||||
}).Info("Started monitoring")
|
||||
logrus.WithFields(logrus.Fields{
|
||||
"every": config.Cfg.ResetTimedOutTasksInterval.String(),
|
||||
}).Info("Started task cleanup cron")
|
||||
}
|
||||
|
||||
func New() *WebAPI {
|
||||
|
||||
11
api/task.go
11
api/task.go
@@ -230,13 +230,12 @@ func (api *WebAPI) ReleaseTask(r *Request) {
|
||||
|
||||
if !res {
|
||||
response.Message = "Task was not marked as closed"
|
||||
} else {
|
||||
|
||||
logrus.WithFields(logrus.Fields{
|
||||
"releaseTaskRequest": req,
|
||||
"taskUpdated": res,
|
||||
}).Trace("Release task")
|
||||
}
|
||||
|
||||
logrus.WithFields(logrus.Fields{
|
||||
"releaseTaskRequest": req,
|
||||
"taskUpdated": res,
|
||||
}).Trace("Release task")
|
||||
|
||||
r.OkJson(response)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user