Skip to content

Commit

Permalink
Changes:
Browse files Browse the repository at this point in the history
- remove references to scheduled_task which was replaced by the Task object as decorator
  • Loading branch information
devkral committed Oct 21, 2024
1 parent cb8d058 commit e62863f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
6 changes: 1 addition & 5 deletions asyncz/tasks/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,7 @@ def update_task( # type: ignore
else:
raise TypeError("fn must be a callable or a textual reference to a callable.")

if (
fn is not None
and not getattr(self, "name", None)
and updates.get("name", None) is None
):
if fn is not None and not getattr(self, "name", None) and updates.get("name") is None:
updates["name"] = get_callable_name(cast(Callable[..., Any], fn))

if isinstance(args, str) or not isinstance(args, Iterable):
Expand Down
4 changes: 2 additions & 2 deletions docs/triggers.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Use the `start_at` and `end_at` to provide a limit in which the scheduler should
{!> ../docs_src/triggers/interval/example2.py !}
```

What about using the `scheduled_task` decorator?
What about using `add_task` as decorator?

```python hl_lines="8"
{!> ../docs_src/triggers/interval/example3.py !}
Expand Down Expand Up @@ -246,7 +246,7 @@ Use the `start_at` and `end_at` to provide a limit in which the scheduler should
{!> ../docs_src/triggers/cron/example2.py !}
```

What about using the `scheduled_task` decorator?
What about using `add_task` as decorator?

```python hl_lines="7"
{!> ../docs_src/triggers/cron/example3.py !}
Expand Down
2 changes: 1 addition & 1 deletion docs_src/triggers/cron/example3.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
scheduler = AsyncIOScheduler()


@scheduler.scheduled_task("cron", hours=1, id="my_task_id", day="last sat")
@scheduler.add_task("cron", hours=1, id="my_task_id", day="last sat")
def my_task():
logger.info("My task working")

Expand Down
2 changes: 1 addition & 1 deletion docs_src/triggers/interval/example3.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


# Run every 5 hours
@scheduler.scheduled_task("interval", hours=5, id="my_task_id")
@scheduler.add_task("interval", hours=5, id="my_task_id")
def my_task():
logger.info("My task working")

Expand Down

0 comments on commit e62863f

Please sign in to comment.