Add slack and github connectors

This commit is contained in:
mudler
2024-04-09 18:24:47 +02:00
parent 414a973282
commit 4453f43bec
11 changed files with 423 additions and 34 deletions

View File

@@ -557,21 +557,26 @@ func (a *Agent) Run() error {
// Expose a REST API to interact with the agent to ask it things
todoTimer := time.NewTicker(a.options.periodicRuns)
//todoTimer := time.NewTicker(a.options.periodicRuns)
timer := time.NewTimer(a.options.periodicRuns)
for {
select {
case job := <-a.jobQueue:
// Consume the job and generate a response
// TODO: Give a short-term memory to the agent
a.consumeJob(job, UserRole)
timer.Reset(a.options.periodicRuns)
case <-a.context.Done():
// Agent has been canceled, return error
// Agent has been canceled, return error
return ErrContextCanceled
case <-todoTimer.C:
case <-timer.C:
if !a.options.standaloneJob {
continue
}
// TODO: We should also do not immediately fire this timer but
// instead have a cool-off timer starting after we received the last job
a.periodicallyRun()
timer.Reset(a.options.periodicRuns)
}
}
}