Bug 38104 - share_usage_with_koha_community.pl: Check between two runs should be a bit lower than 30d
Summary: share_usage_with_koha_community.pl: Check between two runs should be a bit lo...
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor
Assignee: Marcel de Rooy
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-10-07 09:05 UTC by Marcel de Rooy
Modified: 2024-10-07 09:31 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 38104: Adjust number of seconds in UsageStats::NeedUpdate (1.26 KB, patch)
2024-10-07 09:30 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel de Rooy 2024-10-07 09:05:13 UTC
From production data:

HEA preference: 1725159125
select FROM_UNIXTIME( 1725159125 );
| 2024-09-01 04:52:05         |

select * from action_logs where timestamp>'2024-10-01' and module='CRONJOBS' and script like '%usage%';
|   7429456 | 2024-10-01 04:52:04 |    0 | CRONJOBS | Run    | 116996 | /usr/share/koha/misc/cronjobs/share_usage_with_koha_community.pl           | cron      | share_usage_with_koha_community.pl |
|   7429457 | 2024-10-01 04:52:04 |    0 | CRONJOBS | End    | 116996 | /usr/share/koha/misc/cronjobs/share_usage_with_koha_community.pl COMPLETED | cron      | share_usage_with_koha_community.pl |

So the HEA update was skipped since the script was 1 second too early :)
Comment 1 Marcel de Rooy 2024-10-07 09:06:12 UTC
Since we run this script from cron.monthly, it would be enough to check for say four weeks.
Comment 2 Marcel de Rooy 2024-10-07 09:30:04 UTC
Created attachment 172447 [details] [review]
Bug 38104: Adjust number of seconds in UsageStats::NeedUpdate

Test plan:
Check pref UsageStatsLastUpdateTime
Run perl -MC4::UsageStats -e'print C4::UsageStats::NeedUpdate()'
Verify that it prints 1 only if time interval exceeds 4 weeks.
Temporarily clear this pref.
Run again. Should always print 1 now.
Restore pref value.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>