Skip to content

drivers: fix task state reported to on_task_change on ttl - #257

Merged
Col-Waltz merged 1 commit into
masterfrom
bigbes/gh-255-otc-ttl-state
Sep 8, 2026
Merged

drivers: fix task state reported to on_task_change on ttl#257
Col-Waltz merged 1 commit into
masterfrom
bigbes/gh-255-otc-ttl-state

Conversation

@bigbes

@bigbes bigbes commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

In the "ttl tasks" loop of the fifottl and utubettl driver fibers the loop variable shadowed the 'state' module. Inside the loop state is a status string, so state.DONE indexes a string, evaluates to nil, and transform(2, 1, nil) sets the status field to NULL instead of DONE. The task passed to the user's on_task_change callback with the 'ttl' event was therefore malformed. Rename the loop variable to task_state.

Closes #255

In the "ttl tasks" loop of the fifottl and utubettl driver fibers the loop
variable shadowed the 'state' module:

    for _, state in pairs(ttl_states) do
        ...
        task = self:delete(task[i_id]):transform(2, 1, state.DONE)

Inside the loop `state` is a status string, so `state.DONE` indexes a string,
evaluates to nil, and `transform(2, 1, nil)` sets the status field to NULL
instead of DONE. The task passed to the user's on_task_change callback with
the 'ttl' event was therefore malformed.

Rename the loop variable to `task_state`.

Closes #255
@Col-Waltz
Col-Waltz merged commit 0598d00 into master Sep 8, 2026
23 checks passed
@Col-Waltz
Col-Waltz deleted the bigbes/gh-255-otc-ttl-state branch September 8, 2026 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

drivers: on_task_change gets a NULL task status on ttl expiration

3 participants