Skip to content

Bug: Error handling #4

Description

@moff4

Looks like if decorated function raises error here, FunctionThread.running would not be set to False, and afterwards it won't be poped from list running_functions until the program ends. This can be a memory leak

This code can be a fix:

    def run(self):
        self.running = True
        now = datetime.now()
        try:
            if asyncio.iscoroutinefunction(self.function):
                asyncio.run(self.function(now))
            else:
                self.function(now)
        finally:
            self.running = False

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions