Skip to content

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

Open
bigbes wants to merge 1 commit into
masterfrom
bigbes/gh-255-otc-ttl-state
Open

drivers: fix task state reported to on_task_change on ttl#257
bigbes wants to merge 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
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

1 participant