Volltext-Suche: Hintergrund-Job nachts aktivieren
authorBernd Bleßmann <bernd@kivitendo-premium.de>
Wed, 18 May 2022 12:38:32 +0000 (14:38 +0200)
committerBernd Bleßmann <bernd@kivitendo-premium.de>
Wed, 18 May 2022 13:26:49 +0000 (15:26 +0200)
SL/BackgroundJob/CreateOrUpdateFileFullTexts.pm
sql/Pg-upgrade2/full_texts_background_job.sql [new file with mode: 0644]

index e354aa1..055accd 100644 (file)
@@ -22,7 +22,7 @@ my %extractor_by_mime_type = (
 );
 
 sub create_job {
-  $_[0]->create_standard_job('7 * * * *'); # seven minutes after every hour
+  $_[0]->create_standard_job('20 3 * * *'); # # every day at 3:20 am
 }
 
 #
diff --git a/sql/Pg-upgrade2/full_texts_background_job.sql b/sql/Pg-upgrade2/full_texts_background_job.sql
new file mode 100644 (file)
index 0000000..15a1ec9
--- /dev/null
@@ -0,0 +1,13 @@
+-- @tag: full_texts_background_job
+-- @description: Hintergrundjob für tägliche Extraktion von Texten aus Dokumenten
+-- @depends: release_3_6_0
+
+INSERT INTO background_jobs (type, package_name, active, cron_spec, next_run_at)
+VALUES ('interval', 'CreateOrUpdateFileFullTexts', true, '20 3 * * *',
+  CAST(current_date AS timestamp) + CAST(
+    (CASE
+     WHEN extract('hour' FROM current_timestamp) < 2 THEN '3 hours 20 minutes'
+     ELSE                                                 '1 day 3 hours 20 minutes'
+     END) AS interval
+  )
+);