Bugzilla – Attachment 176674 Details for
Bug 38104
share_usage_with_koha_community.pl: Check between two runs is not needed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38104: Adjust number of seconds in UsageStats::NeedUpdate
Bug-38104-Adjust-number-of-seconds-in-UsageStatsNe.patch (text/plain), 2.22 KB, created by
Marcel de Rooy
on 2025-01-16 15:15:00 UTC
(
hide
)
Description:
Bug 38104: Adjust number of seconds in UsageStats::NeedUpdate
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2025-01-16 15:15:00 UTC
Size:
2.22 KB
patch
obsolete
>From a50735c61cb762361abce8bb581ca1c9ce231ff1 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 7 Oct 2024 09:16:59 +0000 >Subject: [PATCH] Bug 38104: Adjust number of seconds in UsageStats::NeedUpdate >Content-Type: text/plain; charset=utf-8 > >The current interval between two HEA updates is hardcoded to >2592000 seconds, i.e. 30 days. This should be a bit lower >to compensate for shorter months (Feb) or a small difference >in execution time under cron. > >This patch adjusts the 30 days to 27 days. This allows us to not >miss February too. Note that if you set it to 28 days, a few minutes >difference could already cause a HEA skip too. > >Test plan: >Enable pref UsageStats. >Check pref UsageStatsLastUpdateTime (under Local use). >Keep the value X somewhere. (Don't worry if it was empty.) >You can convert this value X with: > perl -MPOSIX -e 'print POSIX::strftime("%Y-%m-%d %H:%M:%S\n", localtime(X) )' >The current time is shown in seconds with: > perl -e'print time()' > >Enter a value like 1234 in UsageStatsLastUpdateTime. This should >trigger an update normally. >Run perl -MC4::UsageStats -e'print C4::UsageStats::NeedUpdate()' >This should print 1. >Now put the current time in seconds in the pref (see above). >Run perl -MC4::UsageStats -e'print C4::UsageStats::NeedUpdate()' >This should print 0. >[BONUS] Test with a value now - 26 days, now - 28 days. >Temporarily clear the pref. >Run again. Should print 1 again. >Restore pref value. >Disable UsageStats if it was not enabled. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > C4/UsageStats.pm | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > >diff --git a/C4/UsageStats.pm b/C4/UsageStats.pm >index 37b4a76ec4..1f5fef929c 100644 >--- a/C4/UsageStats.pm >+++ b/C4/UsageStats.pm >@@ -25,6 +25,8 @@ use JSON qw( decode_json encode_json ); > > use Koha::Libraries; > >+use constant MIN_INTERVAL_BETWEEN_RUNS => 2332800; # 27 days * 24 hrs * 60 min * 60 sec >+ > =head1 NAME > > C4::UsageStats >@@ -51,7 +53,7 @@ sub NeedUpdate { > my $now = strftime( "%s", localtime ); > > # Need to launch cron. >- return 1 if $now - $lastupdated >= 2592000; >+ return 1 if $now - $lastupdated > MIN_INTERVAL_BETWEEN_RUNS; > > # Data don't need to be updated > return 0; >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 38104
:
172447
|
176674
|
176702
|
176957
|
177096