Skip to content

Get rid of threads #18

Open
Open

Description

@double-fault

For some reason, threading in Python isn't really preferred (I never could understand why...). The BackgroundTaskManager currently uses threads to schedule and run various tasks simultaneously.

Since the code already exists, I don't plan on discarding it, but an option to not use threads would be rather nice. In such situations, an alternative function belonging to the Bot class will need to be called in an infinite loop, which will schedule the tasks using a simple check of elapsed time.

This change, along with a couple of bugfixes should be enough for version 1.

Activity

  1. tripleee commented on Apr 14, 2019

    @tripleee
    Collaborator

    ChatExchange uses threading anyway, so I really don't know if this makes sense. Perhaps if ChatExchange went async, it would make sense for us to follow suit.

    (I'm certainly a threading skeptic, so I'm all for it in principle. No objection if we can lead the way; but I doubt our example could compel upstream to make large architectural changes.)

  2. double-fault commented on Apr 14, 2019

    @double-fault
    MemberAuthor

    @tripleee I've used threads quite a lot, and I usually don't see any problem with them, but switching away from threads in the BackgroundTaskManager will have other advantages, IMO.

    Currently, every task has it's own thread, which could make it difficult to debug some situations. Plus, async should use a lot less memory than the current threading system.

    This isn't very high on my priority list (whenever I actually get time..), since some other bugs exist which block some functionality. But, I guess, it could be something nice to have.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions