Skip to content

Actor.reboot calls listeners without parameter #405

@metalwarrior665

Description

@metalwarrior665

Issue description

Actor.reboot calls all listeners attached to persistState and migrating. Our code examples expect data to be an object but currently reboot calls listeners without parameters so the example would crash.

At minimum we should send empty object but ideally we figure out some values that are consistent. Currently, there can be { isMigrating: boolean } (and I recently proposed also { isAborting: boolean } so I guess we should re-send these. We could include something like calledByReboot: boolean so users can not persist again after the same listener is called again but I wouldn't do that yet, we might want to rethink how this works (will make separate issue)

Code sample

Actor.on('persistState', async (data) => {
    // This listener is called again by reboot but 'data' is undefined
    if (data.isMigrating) {
        await Actor.reboot()
    }
})

Package version

latest

Node.js version

latest

Operating system

No response

Actor or run link

No response

I have tested this on the next release

No response

Other context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working.t-toolingIssues with this label are in the ownership of the tooling team.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions