Skip to content

Commit

Permalink
BAC-546 Edit documentation with dynamic jobs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shirockov Igor committed Sep 9, 2021
1 parent 214084d commit 52c6aa1
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ sch := scheduler.New(

go sch.Run()
```

## Additional usage
You can also add a static interval for the execution of tasks. If a time is specified for a task, then it will be singleton.
You can add a static interval for the execution of tasks. If a time is specified for a task, then it will be singleton.

```golang
taskPlan := scheduler.TaskPlan{
Expand All @@ -49,7 +50,22 @@ sch.Configure(taskPlan)
// ...
go sch.Run()
```
You can also create your task model for scheduler migration. To do this, make sure your structure meets the minimum requirements of the basic scheduler structure:

You can add a dynamic tasks adding code after running scheduler.

```golang
go sch.Run()
// ...
sch.Add(
"upd_print", // alias
"upd_print_1", // current name
scheduler.FuncArgs{ "name": "Ivan" }, // arguments
time.Now().Add(time.Second*10), // runAt
5, // interval in minutes
)
```

You can create your task model for scheduler migration. To do this, make sure your structure meets the minimum requirements of the basic scheduler structure:
```golang
type Task struct {
ID uint `gorm:"primary_key"`
Expand Down

0 comments on commit 52c6aa1

Please sign in to comment.