Diff -- /var/www/vhosts/3dshawn.com/admin.3dshawn.com/auto_ack_tick.pl
Diff
/var/www/vhosts/3dshawn.com/admin.3dshawn.com/auto_ack_tick.pl
added on local at 2026-07-10 14:13:10
Added
+0
lines
Removed
-0
lines
Context
46
unchanged
Blobs
from 3bbbb0d327ab
to 3bbbb0d327ab
to 3bbbb0d327ab
Unified diff
Naive LCS-based line diff. Additions in emerald, deletions in rose. Both sides decompressed live from BLOB_STORE.| 1 | 1 | #!/usr/bin/perl |
| 2 | 2 | #====================================================================== |
| 3 | 3 | # Meta-Admin -- auto-ack cron tick. |
| 4 | 4 | # |
| 5 | 5 | # Cron entrypoint (NOT a CGI). Runs every minute from |
| 6 | 6 | # /etc/cron.d/meta_admin_auto_ack. Two phases: |
| 7 | 7 | # |
| 8 | 8 | # discover() -- scan for eligible new threads, queue with random delay |
| 9 | 9 | # fire_ready() -- send anything past its fire_at |
| 10 | 10 | # |
| 11 | 11 | # Both phases short-circuit if the global kill switch is OFF (safe default). |
| 12 | 12 | # All state changes flow through MODS::MetaAdmin::AutoAck so this file |
| 13 | 13 | # stays trivial and diff-free after the initial deploy. |
| 14 | 14 | # |
| 15 | 15 | # Log lines go to STDOUT/STDERR; cron config pipes to |
| 16 | 16 | # /var/www/vhosts/3dshawn.com/admin.3dshawn.com/auto_ack.log |
| 17 | 17 | #====================================================================== |
| 18 | 18 | use strict; |
| 19 | 19 | use warnings; |
| 20 | 20 | use lib '/var/www/vhosts/3dshawn.com/admin.3dshawn.com'; |
| 21 | 21 | use POSIX (); |
| 22 | 22 | use MODS::MetaAdmin::AutoAck; |
| 23 | 23 | |
| 24 | 24 | my $ts = POSIX::strftime('%Y-%m-%d %H:%M:%S', localtime); |
| 25 | 25 | my $aa = MODS::MetaAdmin::AutoAck->new; |
| 26 | 26 | |
| 27 | 27 | if (!$aa->is_globally_enabled) { |
| 28 | 28 | # Silent no-op when disabled -- keeps log noise low. |
| 29 | 29 | exit 0; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | my $queued = eval { $aa->discover } // 0; |
| 33 | 33 | my $fired = eval { $aa->fire_ready } // []; |
| 34 | 34 | |
| 35 | 35 | my $n_fired = scalar grep { $_->{action} eq 'sent' } @$fired; |
| 36 | 36 | my $n_skipped = scalar grep { $_->{action} eq 'skipped' } @$fired; |
| 37 | 37 | my $n_failed = scalar grep { $_->{action} eq 'failed' } @$fired; |
| 38 | 38 | |
| 39 | 39 | if ($queued || @$fired) { |
| 40 | 40 | print "[$ts] queued=$queued fired=$n_fired skipped=$n_skipped failed=$n_failed\n"; |
| 41 | 41 | foreach my $line (@{ $aa->log_lines }) { |
| 42 | 42 | print "[$ts] $line\n"; |
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | exit 0; |