• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

修訂7e2cac11847ac296f80ab0e012a4e9718bbf91bf (tree)
時間2020-08-31 04:38:49
作者HMML <hmml3939@gmai...>
CommiterHMML

Log Message

Change cleanup job structure, add feed cleaner.

Change Summary

差異

--- /dev/null
+++ b/lib/tasks/cleanup.rake
@@ -0,0 +1,20 @@
1+namespace :cleanup do
2+ desc "Cleanup old dist signals"
3+ task signals: :environment do
4+ count = DistSignal.where(status: %i(completed failed ignored)).
5+ where("created_at < ?", 1.week.ago).delete_all
6+ Rails.logger.info "Remove old #{count} dist signals"
7+ end
8+
9+ desc "Cleanup expired drafts"
10+ task drafts: :environment do
11+ count = Draft.where("expires_at < ?", Time.now).delete_all
12+ Rails.logger.info "Remove expired #{count} drafts"
13+ end
14+
15+ desc "Cleanup old feed"
16+ task jma_feeds: :environment do
17+ count = JmaFeed.where("feed_time < ?", 2.days.ago).delete_all
18+ Rails.logger.info "Remove expired #{count} drafts"
19+ end
20+end
--- a/lib/tasks/cleanup_dist_signals.rake
+++ /dev/null
@@ -1,10 +0,0 @@
1-namespace :dist_signals do
2- desc "Cleanup old dist signals"
3- task cleanup: :environment do
4- DistSignal.transaction do
5- count = DistSignal.where(status: %i(completed failed ignored)).
6- where("created_at < ?", 1.week.ago).delete_all
7- Rails.logger.info "Remove old #{count} dist signals"
8- end
9- end
10-end
--- a/lib/tasks/cleanup_draft.rake
+++ /dev/null
@@ -1,9 +0,0 @@
1-namespace :drafts do
2- desc "Cleanup expired drafts"
3- task cleanup: :environment do
4- Draft.transaction do
5- count = Draft.where("expires_at < ?", Time.now).delete_all
6- Rails.logger.info "Remove expired #{count} drafts"
7- end
8- end
9-end