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>
Paillat-dev
Paillat-dev previously approved these changes Sep 21, 2025
Copy link
Member

@Paillat-dev Paillat-dev left a comment

Choose a reason for hiding this comment

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

lgtm, tested

@Soheab
Copy link
Contributor

Soheab commented Sep 22, 2025

This could use a little example, either in the docs or in the directory. As it's asked for once in a while, and an example could help with explaining it in detail.

For loop in general or mainly for overlap ?

The latter. Like one that shows a common use case and explains it a little bit.

@Lumabots Lumabots requested a review from Lulalaby October 10, 2025 16:56
Copy link
Contributor

@Soheab Soheab left a comment

Choose a reason for hiding this comment

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

Tested using the added example, works perfectly. Big fan of this feature.

@Soheab Soheab dismissed DA-344’s stale review October 10, 2025 21:48

Already handled.

@Paillat-dev Paillat-dev enabled auto-merge (squash) October 11, 2025 11:01
@Paillat-dev
Copy link
Member

@Pycord-Development/maintain-discord-api pls thx :)

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.

a

@Paillat-dev Paillat-dev merged commit 65b8b61 into Pycord-Development:master Oct 20, 2025
28 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Pycord Releases Oct 20, 2025
Paillat-dev pushed a commit to Pycord-Development/pycord-next that referenced this pull request Oct 26, 2025
…cutions (Pycord-Development#2771)

Co-authored-by: plun1331 <plun1331@gmail.com>
Co-authored-by: JustaSqu1d <89910983+JustaSqu1d@users.noreply.github.com>
Co-authored-by: DA344 <108473820+DA-344@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

(cherry picked from commit 65b8b61)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Implements a feature

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

7 participants