Skip to content

Commit

Permalink
add logs for debugging (#277)
Browse files Browse the repository at this point in the history
  • Loading branch information
BarkovBG committed Jan 29, 2024
1 parent 7b87d31 commit 9209c0f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 7 additions & 0 deletions cloud/tasks/lister.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ func (l *lister) loop(ctx context.Context) {
value, _ := l.inflightTasksByType.LoadOrStore(task.TaskType, int64(0))
taskCount := value.(int64)

logging.Debug(
ctx,
"lister listed %v tasks with taskType %v",
taskCount,
task.TaskType,
)

if taskCount >= taskLimit {
taskIdx++
// Skip task in order not to exceed limit for inflight tasks count
Expand Down
7 changes: 3 additions & 4 deletions cloud/tasks/tasks_tests/tasks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -687,12 +687,11 @@ func TestTasksRunningLimit(t *testing.T) {
)
require.NoError(t, err)

logging.Debug(ctx, "Listed running tasks: %v+", runningTasks)

runningLongTaskCount := 0
for _, task := range runningTasks {
taskState, err := s.storage.GetTask(ctx, task.ID)
require.NoError(t, err)

if taskState.TaskType == "long" {
if task.TaskType == "long" {
runningLongTaskCount++
}
}
Expand Down

0 comments on commit 9209c0f

Please sign in to comment.