mirror of
https://github.com/grafana/grafana.git
synced 2024-11-21 16:38:03 -06:00
ShareInternally: Make stale short link expiry optional (#88137)
Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com> Co-authored-by: Isabel Matwawana <76437239+imatwawana@users.noreply.github.com> Co-authored-by: Irene Rodriguez <irene.rodriguez@grafana.com> Co-authored-by: Jack Baldry <jack.baldry@grafana.com>
This commit is contained in:
parent
7fba9ba522
commit
0a255ac5fb
@ -1559,7 +1559,8 @@ enabled = true
|
|||||||
|
|
||||||
#################################### Short Links #############################
|
#################################### Short Links #############################
|
||||||
[short_links]
|
[short_links]
|
||||||
# Short links which are never accessed will be deleted as cleanup. Time is in days. Default is 7 days. Max is 365. 0 means they will be deleted approximately every 10 minutes.
|
# Short links that are never accessed will be deleted as cleanup. Time is set up in days. The default is 7 days. Maximum value is 365.
|
||||||
|
# 0 means they will be deleted approximately every 10 minutes. A negative value (such as -1) will disable expiration.
|
||||||
expire_time = 7
|
expire_time = 7
|
||||||
|
|
||||||
#################################### Internal Grafana Metrics ############
|
#################################### Internal Grafana Metrics ############
|
||||||
|
@ -1872,7 +1872,11 @@ Configures settings around the short link feature.
|
|||||||
|
|
||||||
### expire_time
|
### expire_time
|
||||||
|
|
||||||
Short links which are never accessed are considered expired or stale, and will be deleted as cleanup. Set the expiration time in days. Default is `7` days. Maximum is `365` days, and setting above the maximum will have `365` set instead. Setting `0` means the short links will be cleaned up approximately every 10 minutes.
|
Short links that are never accessed are considered expired or stale and will be deleted as cleanup. Set the expiration time in days. The default is `7` days. The maximum is `365` days, and setting above the maximum will have `365` set instead. Setting `0` means the short links will be cleaned up approximately every 10 minutes. A negative value such as `-1` will disable expiry.
|
||||||
|
|
||||||
|
{{< admonition type="caution" >}}
|
||||||
|
Short links without an expiration increase the size of the database and can’t be deleted.
|
||||||
|
{{< /admonition >}}
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
|
@ -103,12 +103,15 @@ func (srv *CleanUpService) clean(ctx context.Context) {
|
|||||||
{"delete expired images", srv.deleteExpiredImages},
|
{"delete expired images", srv.deleteExpiredImages},
|
||||||
{"cleanup old annotations", srv.cleanUpOldAnnotations},
|
{"cleanup old annotations", srv.cleanUpOldAnnotations},
|
||||||
{"expire old user invites", srv.expireOldUserInvites},
|
{"expire old user invites", srv.expireOldUserInvites},
|
||||||
{"delete stale short URLs", srv.deleteStaleShortURLs},
|
|
||||||
{"delete stale query history", srv.deleteStaleQueryHistory},
|
{"delete stale query history", srv.deleteStaleQueryHistory},
|
||||||
{"expire old email verifications", srv.expireOldVerifications},
|
{"expire old email verifications", srv.expireOldVerifications},
|
||||||
{"cleanup trash dashboards", srv.cleanUpTrashDashboards},
|
{"cleanup trash dashboards", srv.cleanUpTrashDashboards},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if srv.Cfg.ShortLinkExpiration > 0 {
|
||||||
|
cleanupJobs = append(cleanupJobs, cleanUpJob{"delete stale short URLs", srv.deleteStaleShortURLs})
|
||||||
|
}
|
||||||
|
|
||||||
logger := srv.log.FromContext(ctx)
|
logger := srv.log.FromContext(ctx)
|
||||||
logger.Debug("Starting cleanup jobs", "jobs", fmt.Sprintf("%v", cleanupJobs))
|
logger.Debug("Starting cleanup jobs", "jobs", fmt.Sprintf("%v", cleanupJobs))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user