Skip to content

Commit

Permalink
Fix extracting ttl from query response
Browse files Browse the repository at this point in the history
  • Loading branch information
fimanishi committed Jan 15, 2025
1 parent 08db89e commit 331fb17
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion common/persistence/nosql/nosqlplugin/cassandra/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ PopulateTasks:
}

// Extract the TTL value
ttlValue, ttlExists := task["task"].(map[string]interface{})["ttl"]
ttlValue, ttlExists := task["ttl"]

// Check if TTL is null or an integer
var ttl *int
Expand Down
8 changes: 4 additions & 4 deletions common/persistence/nosql/nosqlplugin/cassandra/tasks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -994,23 +994,23 @@ func TestSelectTasks(t *testing.T) {
"domain_id": &fakeUUID{uuid: "domain1"},
"workflow_id": "wid1",
"schedule_id": int64(42),
"ttl": 2,
"created_time": ts,
"run_id": &fakeUUID{uuid: "runid1"},
"partition_config": map[string]string{},
},
"ttl": 2,
},
{
"task_id": int64(2),
"task": map[string]interface{}{
"domain_id": &fakeUUID{uuid: "domain1"},
"workflow_id": "wid1",
"schedule_id": int64(45),
"ttl": nil,
"created_time": ts,
"run_id": &fakeUUID{uuid: "runid1"},
"partition_config": map[string]string{},
},
"ttl": nil,
},
{
"missing_task_id": int64(1), // missing task_id so this row will be skipped
Expand All @@ -1021,23 +1021,23 @@ func TestSelectTasks(t *testing.T) {
"domain_id": &fakeUUID{uuid: "domain1"},
"workflow_id": "wid1",
"schedule_id": int64(48),
"ttl": 4,
"created_time": ts,
"run_id": &fakeUUID{uuid: "runid1"},
"partition_config": map[string]string{},
},
"ttl": 4,
},
{
"task_id": int64(4), // this will be skipped because filter.BatchSize is reached
"task": map[string]interface{}{
"domain_id": &fakeUUID{uuid: "domain1"},
"workflow_id": "wid1",
"schedule_id": int64(51),
"ttl": 5,
"created_time": ts,
"run_id": &fakeUUID{uuid: "runid1"},
"partition_config": map[string]string{},
},
"ttl": 5,
},
},
},
Expand Down

0 comments on commit 331fb17

Please sign in to comment.