Change @every 24h default schedules to @midnight (#16431)

tokarchuk/v1.17
Jimmy Praet 3 years ago committed by GitHub
parent 195c9999a1
commit 8df3d6575a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      custom/conf/app.example.ini
  2. 12
      docs/content/doc/advanced/config-cheat-sheet.en-us.md
  3. 6
      docs/content/doc/advanced/config-cheat-sheet.zh-cn.md
  4. 14
      modules/cron/tasks_basic.go

@ -1671,7 +1671,7 @@ PATH =
;; Notice if not success ;; Notice if not success
;NO_SUCCESS_NOTICE = false ;NO_SUCCESS_NOTICE = false
;; Time interval for job to run ;; Time interval for job to run
;SCHEDULE = @every 24h ;SCHEDULE = @midnight
;; Archives created more than OLDER_THAN ago are subject to deletion ;; Archives created more than OLDER_THAN ago are subject to deletion
;OLDER_THAN = 24h ;OLDER_THAN = 24h
@ -1697,7 +1697,7 @@ PATH =
;[cron.repo_health_check] ;[cron.repo_health_check]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;SCHEDULE = @every 24h ;SCHEDULE = @midnight
;; Enable running Repository health check task periodically. ;; Enable running Repository health check task periodically.
;ENABLED = true ;ENABLED = true
;; Run Repository health check task when Gitea starts. ;; Run Repository health check task when Gitea starts.
@ -1722,7 +1722,7 @@ PATH =
;RUN_AT_START = true ;RUN_AT_START = true
;; Notice if not success ;; Notice if not success
;NO_SUCCESS_NOTICE = false ;NO_SUCCESS_NOTICE = false
;SCHEDULE = @every 24h ;SCHEDULE = @midnight
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -1736,7 +1736,7 @@ PATH =
;; Notice if not success ;; Notice if not success
;NO_SUCCESS_NOTICE = false ;NO_SUCCESS_NOTICE = false
;; Interval as a duration between each synchronization. (default every 24h) ;; Interval as a duration between each synchronization. (default every 24h)
;SCHEDULE = @every 24h ;SCHEDULE = @midnight
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -1751,7 +1751,7 @@ PATH =
;; Notice if not success ;; Notice if not success
;NO_SUCCESS_NOTICE = false ;NO_SUCCESS_NOTICE = false
;; Interval as a duration between each synchronization (default every 24h) ;; Interval as a duration between each synchronization (default every 24h)
;SCHEDULE = @every 24h ;SCHEDULE = @midnight
;; Create new users, update existing user data and disable users that are not in external source anymore (default) ;; Create new users, update existing user data and disable users that are not in external source anymore (default)
;; or only create new users if UPDATE_EXISTING is set to false ;; or only create new users if UPDATE_EXISTING is set to false
;UPDATE_EXISTING = true ;UPDATE_EXISTING = true
@ -1769,7 +1769,7 @@ PATH =
;; Notice if not success ;; Notice if not success
;NO_SUCCESS_NOTICE = false ;NO_SUCCESS_NOTICE = false
;; Interval as a duration between each synchronization (default every 24h) ;; Interval as a duration between each synchronization (default every 24h)
;SCHEDULE = @every 24h ;SCHEDULE = @midnight
;; deleted branches than OLDER_THAN ago are subject to deletion ;; deleted branches than OLDER_THAN ago are subject to deletion
;OLDER_THAN = 24h ;OLDER_THAN = 24h
@ -1785,7 +1785,7 @@ PATH =
;; Whether to always run at start up time (if ENABLED) ;; Whether to always run at start up time (if ENABLED)
;RUN_AT_START = false ;RUN_AT_START = false
;; Time interval for job to run ;; Time interval for job to run
;SCHEDULE = @every 24h ;SCHEDULE = @midnight
;; OlderThan or PerWebhook. How the records are removed, either by age (i.e. how long ago hook_task record was delivered) or by the number to keep per webhook (i.e. keep most recent x deliveries per webhook). ;; OlderThan or PerWebhook. How the records are removed, either by age (i.e. how long ago hook_task record was delivered) or by the number to keep per webhook (i.e. keep most recent x deliveries per webhook).
;CLEANUP_TYPE = OlderThan ;CLEANUP_TYPE = OlderThan
;; If CLEANUP_TYPE is set to OlderThan, then any delivered hook_task records older than this expression will be deleted. ;; If CLEANUP_TYPE is set to OlderThan, then any delivered hook_task records older than this expression will be deleted.

@ -740,7 +740,7 @@ NB: You must have `DISABLE_ROUTER_LOG` set to `false` for this option to take ef
- `ENABLED`: **true**: Enable service. - `ENABLED`: **true**: Enable service.
- `RUN_AT_START`: **true**: Run tasks at start up time (if ENABLED). - `RUN_AT_START`: **true**: Run tasks at start up time (if ENABLED).
- `SCHEDULE`: **@every 24h**: Cron syntax for scheduling repository archive cleanup, e.g. `@every 1h`. - `SCHEDULE`: **@midnight**: Cron syntax for scheduling repository archive cleanup, e.g. `@every 1h`.
- `OLDER_THAN`: **24h**: Archives created more than `OLDER_THAN` ago are subject to deletion, e.g. `12h`. - `OLDER_THAN`: **24h**: Archives created more than `OLDER_THAN` ago are subject to deletion, e.g. `12h`.
#### Cron - Update Mirrors (`cron.update_mirrors`) #### Cron - Update Mirrors (`cron.update_mirrors`)
@ -750,31 +750,31 @@ NB: You must have `DISABLE_ROUTER_LOG` set to `false` for this option to take ef
#### Cron - Repository Health Check (`cron.repo_health_check`) #### Cron - Repository Health Check (`cron.repo_health_check`)
- `SCHEDULE`: **@every 24h**: Cron syntax for scheduling repository health check. - `SCHEDULE`: **@midnight**: Cron syntax for scheduling repository health check.
- `TIMEOUT`: **60s**: Time duration syntax for health check execution timeout. - `TIMEOUT`: **60s**: Time duration syntax for health check execution timeout.
- `ARGS`: **\<empty\>**: Arguments for command `git fsck`, e.g. `--unreachable --tags`. See more on http://git-scm.com/docs/git-fsck - `ARGS`: **\<empty\>**: Arguments for command `git fsck`, e.g. `--unreachable --tags`. See more on http://git-scm.com/docs/git-fsck
#### Cron - Repository Statistics Check (`cron.check_repo_stats`) #### Cron - Repository Statistics Check (`cron.check_repo_stats`)
- `RUN_AT_START`: **true**: Run repository statistics check at start time. - `RUN_AT_START`: **true**: Run repository statistics check at start time.
- `SCHEDULE`: **@every 24h**: Cron syntax for scheduling repository statistics check. - `SCHEDULE`: **@midnight**: Cron syntax for scheduling repository statistics check.
### Cron - Cleanup hook_task Table (`cron.cleanup_hook_task_table`) ### Cron - Cleanup hook_task Table (`cron.cleanup_hook_task_table`)
- `ENABLED`: **true**: Enable cleanup hook_task job. - `ENABLED`: **true**: Enable cleanup hook_task job.
- `RUN_AT_START`: **false**: Run cleanup hook_task at start time (if ENABLED). - `RUN_AT_START`: **false**: Run cleanup hook_task at start time (if ENABLED).
- `SCHEDULE`: **@every 24h**: Cron syntax for cleaning hook_task table. - `SCHEDULE`: **@midnight**: Cron syntax for cleaning hook_task table.
- `CLEANUP_TYPE` **OlderThan** OlderThan or PerWebhook Method to cleanup hook_task, either by age (i.e. how long ago hook_task record was delivered) or by the number to keep per webhook (i.e. keep most recent x deliveries per webhook). - `CLEANUP_TYPE` **OlderThan** OlderThan or PerWebhook Method to cleanup hook_task, either by age (i.e. how long ago hook_task record was delivered) or by the number to keep per webhook (i.e. keep most recent x deliveries per webhook).
- `OLDER_THAN`: **168h**: If CLEANUP_TYPE is set to OlderThan, then any delivered hook_task records older than this expression will be deleted. - `OLDER_THAN`: **168h**: If CLEANUP_TYPE is set to OlderThan, then any delivered hook_task records older than this expression will be deleted.
- `NUMBER_TO_KEEP`: **10**: If CLEANUP_TYPE is set to PerWebhook, this is number of hook_task records to keep for a webhook (i.e. keep the most recent x deliveries). - `NUMBER_TO_KEEP`: **10**: If CLEANUP_TYPE is set to PerWebhook, this is number of hook_task records to keep for a webhook (i.e. keep the most recent x deliveries).
#### Cron - Update Migration Poster ID (`cron.update_migration_poster_id`) #### Cron - Update Migration Poster ID (`cron.update_migration_poster_id`)
- `SCHEDULE`: **@every 24h** : Interval as a duration between each synchronization, it will always attempt synchronization when the instance starts. - `SCHEDULE`: **@midnight** : Interval as a duration between each synchronization, it will always attempt synchronization when the instance starts.
#### Cron - Sync External Users (`cron.sync_external_users`) #### Cron - Sync External Users (`cron.sync_external_users`)
- `SCHEDULE`: **@every 24h** : Interval as a duration between each synchronization, it will always attempt synchronization when the instance starts. - `SCHEDULE`: **@midnight** : Interval as a duration between each synchronization, it will always attempt synchronization when the instance starts.
- `UPDATE_EXISTING`: **true**: Create new users, update existing user data and disable users that are not in external source anymore (default) or only create new users if UPDATE_EXISTING is set to false. - `UPDATE_EXISTING`: **true**: Create new users, update existing user data and disable users that are not in external source anymore (default) or only create new users if UPDATE_EXISTING is set to false.
### Extended cron tasks (not enabled by default) ### Extended cron tasks (not enabled by default)

@ -257,18 +257,18 @@ test01.xls: application/vnd.ms-excel; charset=binary
### Cron - Repository Health Check (`cron.repo_health_check`) ### Cron - Repository Health Check (`cron.repo_health_check`)
- `SCHEDULE`: 仓库健康监测的Cron语法,比如:`@every 24h`。 - `SCHEDULE`: 仓库健康监测的Cron语法,比如:`@midnight`。
- `TIMEOUT`: 仓库健康监测的超时时间,比如:`60s`. - `TIMEOUT`: 仓库健康监测的超时时间,比如:`60s`.
- `ARGS`: 执行 `git fsck` 命令的参数,比如:`--unreachable --tags`。 - `ARGS`: 执行 `git fsck` 命令的参数,比如:`--unreachable --tags`。
### Cron - Repository Statistics Check (`cron.check_repo_stats`) ### Cron - Repository Statistics Check (`cron.check_repo_stats`)
- `RUN_AT_START`: 是否启动时自动运行仓库统计。 - `RUN_AT_START`: 是否启动时自动运行仓库统计。
- `SCHEDULE`: 仓库统计时的Cron 语法,比如:`@every 24h`. - `SCHEDULE`: 仓库统计时的Cron 语法,比如:`@midnight`.
### Cron - Update Migration Poster ID (`cron.update_migration_poster_id`) ### Cron - Update Migration Poster ID (`cron.update_migration_poster_id`)
- `SCHEDULE`: **@every 24h** : 每次同步的间隔时间。此任务总是在启动时自动进行。 - `SCHEDULE`: **@midnight** : 每次同步的间隔时间。此任务总是在启动时自动进行。
## Git (`git`) ## Git (`git`)

@ -36,7 +36,7 @@ func registerRepoHealthCheck() {
BaseConfig: BaseConfig{ BaseConfig: BaseConfig{
Enabled: true, Enabled: true,
RunAtStart: false, RunAtStart: false,
Schedule: "@every 24h", Schedule: "@midnight",
}, },
Timeout: 60 * time.Second, Timeout: 60 * time.Second,
Args: []string{}, Args: []string{},
@ -50,7 +50,7 @@ func registerCheckRepoStats() {
RegisterTaskFatal("check_repo_stats", &BaseConfig{ RegisterTaskFatal("check_repo_stats", &BaseConfig{
Enabled: true, Enabled: true,
RunAtStart: true, RunAtStart: true,
Schedule: "@every 24h", Schedule: "@midnight",
}, func(ctx context.Context, _ *models.User, _ Config) error { }, func(ctx context.Context, _ *models.User, _ Config) error {
return models.CheckRepoStats(ctx) return models.CheckRepoStats(ctx)
}) })
@ -61,7 +61,7 @@ func registerArchiveCleanup() {
BaseConfig: BaseConfig{ BaseConfig: BaseConfig{
Enabled: true, Enabled: true,
RunAtStart: true, RunAtStart: true,
Schedule: "@every 24h", Schedule: "@midnight",
}, },
OlderThan: 24 * time.Hour, OlderThan: 24 * time.Hour,
}, func(ctx context.Context, _ *models.User, config Config) error { }, func(ctx context.Context, _ *models.User, config Config) error {
@ -75,7 +75,7 @@ func registerSyncExternalUsers() {
BaseConfig: BaseConfig{ BaseConfig: BaseConfig{
Enabled: true, Enabled: true,
RunAtStart: false, RunAtStart: false,
Schedule: "@every 24h", Schedule: "@midnight",
}, },
UpdateExisting: true, UpdateExisting: true,
}, func(ctx context.Context, _ *models.User, config Config) error { }, func(ctx context.Context, _ *models.User, config Config) error {
@ -89,7 +89,7 @@ func registerDeletedBranchesCleanup() {
BaseConfig: BaseConfig{ BaseConfig: BaseConfig{
Enabled: true, Enabled: true,
RunAtStart: true, RunAtStart: true,
Schedule: "@every 24h", Schedule: "@midnight",
}, },
OlderThan: 24 * time.Hour, OlderThan: 24 * time.Hour,
}, func(ctx context.Context, _ *models.User, config Config) error { }, func(ctx context.Context, _ *models.User, config Config) error {
@ -103,7 +103,7 @@ func registerUpdateMigrationPosterID() {
RegisterTaskFatal("update_migration_poster_id", &BaseConfig{ RegisterTaskFatal("update_migration_poster_id", &BaseConfig{
Enabled: true, Enabled: true,
RunAtStart: true, RunAtStart: true,
Schedule: "@every 24h", Schedule: "@midnight",
}, func(ctx context.Context, _ *models.User, _ Config) error { }, func(ctx context.Context, _ *models.User, _ Config) error {
return migrations.UpdateMigrationPosterID(ctx) return migrations.UpdateMigrationPosterID(ctx)
}) })
@ -114,7 +114,7 @@ func registerCleanupHookTaskTable() {
BaseConfig: BaseConfig{ BaseConfig: BaseConfig{
Enabled: true, Enabled: true,
RunAtStart: false, RunAtStart: false,
Schedule: "@every 24h", Schedule: "@midnight",
}, },
CleanupType: "OlderThan", CleanupType: "OlderThan",
OlderThan: 168 * time.Hour, OlderThan: 168 * time.Hour,

Loading…
Cancel
Save