Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cron job to cleanup hook_task table #13080

Merged
merged 30 commits into from
Jan 26, 2021
Merged

Conversation

bhalbright
Copy link
Contributor

Ref issue: #10741

Added a cron job to delete webhook deliveries in the hook_task table. It can be turned on/off and the schedule controlled globally via app.ini. The data can be deleted by either the age of the delivery which is the default or by deleting the all but the most recent deliveries per webhook.

Note: I had previously submitted pr #11416 but I closed it when I realized that I had deleted per repository instead of per webhook. Also, I decided allowing the settings to be overridden via the ui was overkill. Also this version allows the deletion by age which is probably what most people would want.

@lafriks
Copy link
Member

lafriks commented Oct 9, 2020

unit test failed

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Oct 9, 2020
@lafriks lafriks added the type/enhancement An improvement of existing functionality label Oct 9, 2020
@lafriks lafriks added this to the 1.14.0 milestone Oct 9, 2020
@bhalbright bhalbright marked this pull request as draft October 9, 2020 19:52
@codecov-io
Copy link

codecov-io commented Oct 11, 2020

Codecov Report

Merging #13080 (f7ed1cd) into master (0f726ca) will increase coverage by 0.01%.
The diff coverage is 72.72%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #13080      +/-   ##
==========================================
+ Coverage   42.09%   42.11%   +0.01%     
==========================================
  Files         758      758              
  Lines       81014    81080      +66     
==========================================
+ Hits        34104    34147      +43     
- Misses      41342    41357      +15     
- Partials     5568     5576       +8     
Impacted Files Coverage Δ
modules/cron/setting.go 70.00% <ø> (ø)
models/webhook.go 71.39% <72.54%> (+0.18%) ⬆️
modules/cron/tasks_basic.go 85.43% <73.33%> (-2.07%) ⬇️
modules/util/timer.go 42.85% <0.00%> (-42.86%) ⬇️
modules/git/tree_nogogit.go 60.86% <0.00%> (-8.70%) ⬇️
modules/git/repo_language_stats_nogogit.go 57.44% <0.00%> (-4.26%) ⬇️
services/pull/check.go 48.52% <0.00%> (-2.95%) ⬇️
models/error.go 39.48% <0.00%> (ø)
services/pull/pull.go 42.15% <0.00%> (ø)
models/gpg_key.go 53.90% <0.00%> (+0.57%) ⬆️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0f726ca...f7ed1cd. Read the comment docs.

@bhalbright bhalbright marked this pull request as ready for review October 11, 2020 03:42
@bhalbright
Copy link
Contributor Author

unit test failed

@lafriks I believe I have them passing now

@lafriks
Copy link
Member

lafriks commented Oct 26, 2020

Please resolve conflicts

…hooktask

# Conflicts:
#	custom/conf/app.example.ini
#	docs/content/doc/advanced/config-cheat-sheet.en-us.md
@bhalbright
Copy link
Contributor Author

bhalbright commented Oct 26, 2020

Please resolve conflicts

@lafriks sure, I resolved them

Copy link
Contributor

@zeripath zeripath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small nit as I don't see any other cron task using CleanupHookTaskConfig it should probably just be moved into the function that uses it.

Otherwise LGTM

modules/cron/setting.go Show resolved Hide resolved
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Oct 27, 2020
@lunny
Copy link
Member

lunny commented Jan 19, 2021

Please fix the lint.

@bhalbright
Copy link
Contributor Author

Please fix the lint.

it is passing the linter now, thanks

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jan 26, 2021
@6543 6543 merged commit a598877 into go-gitea:master Jan 26, 2021
a1012112796 added a commit to a1012112796/gitea that referenced this pull request Jan 27, 2021
* master:
  [skip ci] Updated translations via Crowdin
  Fix bug because of duplicated join (go-gitea#14454)
  Cron job to cleanup hook_task table (go-gitea#13080)
  Fix panic 500 page rendering (go-gitea#14474)
  [skip ci] Updated translations via Crowdin
  Move macaron to chi (go-gitea#14293)
  [skip ci] Updated translations via Crowdin
  Fix incorrect key name so registerManualConfirm setting works as expected. (go-gitea#14455)
a1012112796 added a commit to a1012112796/gitea that referenced this pull request Jan 27, 2021
* master:
  [skip ci] Updated translations via Crowdin
  Fix bug because of duplicated join (go-gitea#14454)
  Cron job to cleanup hook_task table (go-gitea#13080)
  Fix panic 500 page rendering (go-gitea#14474)
  [skip ci] Updated translations via Crowdin
  Move macaron to chi (go-gitea#14293)
  [skip ci] Updated translations via Crowdin
  Fix incorrect key name so registerManualConfirm setting works as expected. (go-gitea#14455)
a1012112796 added a commit to a1012112796/gitea that referenced this pull request Jan 27, 2021
* master:
  [skip ci] Updated translations via Crowdin
  Fix bug because of duplicated join (go-gitea#14454)
  Cron job to cleanup hook_task table (go-gitea#13080)
  Fix panic 500 page rendering (go-gitea#14474)
  [skip ci] Updated translations via Crowdin
  Move macaron to chi (go-gitea#14293)
@go-gitea go-gitea locked and limited conversation to collaborators Mar 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants