Skip to content

Commit

Permalink
improve logging
Browse files Browse the repository at this point in the history
  • Loading branch information
v9n committed Dec 5, 2024
1 parent 8381116 commit 3d45209
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion core/taskengine/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,16 @@ func (x *TaskExecutor) Perform(job *apqueue.Job) error {

defer func() {
updates := map[string][]byte{}
updates[string(TaskStorageKey(task.Id, avsproto.TaskStatus_Executing))], err = task.ToJSON()
updates[string(TaskStorageKey(task.Id, task.Status))], err = task.ToJSON()
updates[string(TaskUserKey(task))] = []byte(fmt.Sprintf("%d", task.Status))

if err = x.db.BatchWrite(updates); err != nil {
// TODO Gracefully handling of storage cleanup
x.logger.Errorf("error updating task status. %w", err, "task_id", task.Id, "job_id", job.ID)
}
}()

// TODO: Track max execution reached to set as completed
currentTime := time.Now()
if err == nil {
x.logger.Info("succesfully executing task", "taskid", job.Name, "triggermark", string(job.Data))
Expand Down
2 changes: 1 addition & 1 deletion core/taskengine/trigger/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (evt *EventTrigger) Run(ctx context.Context) error {
evt.retryConnectToRpc()
sub, err = evt.wsEthClient.SubscribeFilterLogs(context.Background(), query, logs)
case event := <-logs:
evt.logger.Debug("detect new event, evaluate checks", "component", "eventrigger", "event", event)
evt.logger.Debug("detect new event, evaluate checks", "event", event.Topics[0], "contract", event.Address)
// TODO: implement hint to avoid scan all checks
toRemove := []string{}

Expand Down

0 comments on commit 3d45209

Please sign in to comment.