Add background job to abandon inactive changes automatically

Add a change cleanup job that runs periodically in the background.
This cleanup job can automatically abandon open changes that have been
inactive for a defined time.

Abandoning old inactive changes has a few advantages:
- it reduces the load for recomputing the mergeability flag when a
  change is merged
- it keeps dashboards clean
- it signals change authors that changes are considered outdated

Change-Id: Ia798667901fe8d734ca29bcf81c7b9b4a1eb4c50
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin
2015-06-03 10:27:39 +02:00
parent 64d33627b4
commit e326a1dada
12 changed files with 450 additions and 13 deletions

View File

@@ -910,6 +910,76 @@ keyboard shortcut is appended.
Default is "Reply and score". In the user interface it becomes "Reply
and score (Shortcut: a)".
[[changeCleanup]]
=== Section changeCleanup
This section allows to configure change cleanups and schedules them to
run periodically.
[[changeCleanup.abandonAfter]]changeCleanup.abandonAfter::
+
Period of inactivity after which open changes should be abandoned
automatically.
+
By default `0`, never abandon open changes.
+
[WARNING] Auto-Abandoning changes may confuse/annoy users. When
enabling this, make sure to choose a reasonably large grace period and
inform users in advance.
+
The following suffixes are supported to define the time unit:
+
* `d, day, days`
* `w, week, weeks` (`1 week` is treated as `7 days`)
* `mon, month, months` (`1 month` is treated as `30 days`)
* `y, year, years` (`1 year` is treated as `365 days`)
[[changeCleanup.abandonMessage]]changeCleanup.abandonMessage::
+
Change message that should be posted when a change is abandoned.
+
'${URL}' can be used as a placeholder for the Gerrit web URL.
+
By default "Auto-Abandoned due to inactivity, see
${URL}Documentation/user-change-cleanup.html#auto-abandon\n\n
If this change is still wanted it should be restored.".
[[changeCleanup.startTime]]changeCleanup.startTime::
+
Start time to define the first execution of the change cleanups.
If the configured `'changeCleanup.interval'` is shorter than
`'changeCleanup.startTime - now'` the start time will be preponed by
the maximum integral multiple of `'changeCleanup.interval'` so that the
start time is still in the future.
+
----
<day of week> <hours>:<minutes>
or
<hours>:<minutes>
<day of week> : Mon, Tue, Wed, Thu, Fri, Sat, Sun
<hours> : 00-23
<minutes> : 0-59
----
[[changeCleanup.interval]]changeCleanup.interval::
+
Interval for periodic repetition of triggering the change cleanups.
The interval must be larger than zero. The following suffixes are supported
to define the time unit for the interval:
+
* `s, sec, second, seconds`
* `m, min, minute, minutes`
* `h, hr, hour, hours`
* `d, day, days`
* `w, week, weeks` (`1 week` is treated as `7 days`)
* `mon, month, months` (`1 month` is treated as `30 days`)
* `y, year, years` (`1 year` is treated as `365 days`)
link:#schedule-examples[Schedule examples] can be found in the
link:#gc[gc] section.
[[changeMerge]]
=== Section changeMerge
@@ -1519,6 +1589,7 @@ to define the time unit for the interval:
* `mon, month, months` (`1 month` is treated as `30 days`)
* `y, year, years` (`1 year` is treated as `365 days`)
[[schedule-examples]]
Examples::
+
----