Skip to content

Conversation

Lumabots
Copy link
Contributor

@Lumabots Lumabots commented Apr 30, 2025

No description provided.

Lumabots and others added 10 commits April 18, 2025 16:44
…xecutions

Added a new overlap parameter to the loop decorator and Loop class to control whether loop iterations can run concurrently. When set to True, the next iteration will not wait for the previous one to finish, allowing overlapping executions—useful for long-running tasks that should not delay subsequent runs. Defaults to False to preserve current behavior.

Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
…t: 'overlap'

Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
Exception in callback Future.set_result(True)
handle: <TimerHandle when=203424.768941542 Future.set_result(True)>
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/asyncio/events.py", line 84, in _run
    self._context.run(self._callback, *self._args)
asyncio.exceptions.InvalidStateError: invalid state


Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
@Lumabots
Copy link
Contributor Author

sorry i renamed the branch and it deleted the other one

@Lumabots Lumabots changed the title Overlap feat(loop): add optional overlap support to allow concurrent loop executions Apr 30, 2025
Copy link
Member

@plun1331 plun1331 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably add an additional parameter for limiting the number of active tasks

Lumabots and others added 2 commits May 1, 2025 11:17
Co-authored-by: plun1331 <plun1331@gmail.com>
Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
Co-authored-by: plun1331 <plun1331@gmail.com>
Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
@Lumabots
Copy link
Contributor Author

Lumabots commented May 1, 2025

We should probably add an additional parameter for limiting the number of active tasks

maybe:
def init(self, ..., overlap: bool | int = True):

If overlap is:

True: allow overlapping tasks with no limit (default).

False: do not allow overlapping (wait for task to finish).

An int: allow overlapping up to n concurrent tasks.

Lumabots and others added 6 commits May 1, 2025 11:32
add name for the tasks

Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
@Lumabots
Copy link
Contributor Author

Lumabots commented Aug 2, 2025

fixed

Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
@Lumabots Lumabots requested a review from a team as a code owner August 30, 2025 13:16
Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
@Lulalaby Lulalaby requested a review from Copilot August 30, 2025 15:18
@Lulalaby Lulalaby dismissed stale reviews from JustaSqu1d and plun1331 August 30, 2025 15:19

x

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds optional overlap support to the loop decorator and Loop class to allow concurrent executions of loop iterations. Instead of waiting for each iteration to complete before starting the next one, users can now enable overlapping executions.

Key changes:

  • Adds overlap parameter that accepts False (default), True, or an integer for controlled concurrency
  • Uses asyncio tasks and semaphores to manage concurrent executions
  • Adds proper cleanup of running tasks when the loop is cancelled

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
discord/ext/tasks/init.py Implements overlap functionality with task management, semaphore controls, and concurrent execution logic
CHANGELOG.md Documents the new overlap feature in version 2.7

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Lulalaby Lulalaby added this to the v2.7 milestone Aug 30, 2025
@github-project-automation github-project-automation bot moved this to In Progress in Pycord Releases Aug 30, 2025
@Lulalaby Lulalaby added feature Implements a feature on hold labels Aug 30, 2025
@Lulalaby Lulalaby force-pushed the master branch 2 times, most recently from b55c125 to 82659b2 Compare August 30, 2025 21:10
@Lulalaby Lulalaby removed the on hold label Aug 30, 2025
Copy link
Member

@Lulalaby Lulalaby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could that potentially clutch with #2645?

Co-authored-by: DA344 <108473820+DA-344@users.noreply.github.com>
Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
@Lumabots Lumabots requested a review from a team as a code owner August 31, 2025 20:59
@Lumabots
Copy link
Contributor Author

Lumabots commented Sep 7, 2025

Could that potentially clutch with #2645?

Not anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

5 participants