Skip to content

ActorTypeDispatcher Handler Strangeness  #85

@kevincolyar

Description

@kevincolyar

I've been using Thespian for quite a while now and this is the first time I've had to run down an issue like this.

I have a ActorTypeDispatcher actor with the following methods:

    def receiveMsg_Alert(self, alert, _sender):
        logger.warning(f"Alert message received from {_sender} to save: {alert}")

        self.queue.append(alert)
        self.wakeup()

    # TODO: WHY DOES ADDING THIS MAKE receiveMsg_Alert work above?
    def receiveMsg_dict(self, alert, _sender):
        pass

Where the Alert message type is simply:

class Alert(dict):
    pass

For some reason, messages of the Alert type just would not be handled by the first method until I added the _dict handler. Just by chance I added that method to see if the message type wasn't working, but once I did, it started working.

I have several, almost identical actors that have worked for almost 8 years without issue, but this is the first time I've run into this. Ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions