Diff -- /var/www/vhosts/3dshawn.com/admin.3dshawn.com/auto_ack_tick.pl

O Operator
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
Restore this content →
Unified diff
Naive LCS-based line diff. Additions in emerald, deletions in rose. Both sides decompressed live from BLOB_STORE.
11#!/usr/bin/perl
22#======================================================================
33# Meta-Admin -- auto-ack cron tick.
44#
55# Cron entrypoint (NOT a CGI). Runs every minute from
66# /etc/cron.d/meta_admin_auto_ack. Two phases:
77#
88# discover() -- scan for eligible new threads, queue with random delay
99# fire_ready() -- send anything past its fire_at
1010#
1111# Both phases short-circuit if the global kill switch is OFF (safe default).
1212# All state changes flow through MODS::MetaAdmin::AutoAck so this file
1313# stays trivial and diff-free after the initial deploy.
1414#
1515# Log lines go to STDOUT/STDERR; cron config pipes to
1616# /var/www/vhosts/3dshawn.com/admin.3dshawn.com/auto_ack.log
1717#======================================================================
1818use strict;
1919use warnings;
2020use lib '/var/www/vhosts/3dshawn.com/admin.3dshawn.com';
2121use POSIX ();
2222use MODS::MetaAdmin::AutoAck;
2323
2424my $ts = POSIX::strftime('%Y-%m-%d %H:%M:%S', localtime);
2525my $aa = MODS::MetaAdmin::AutoAck->new;
2626
2727if (!$aa->is_globally_enabled) {
2828 # Silent no-op when disabled -- keeps log noise low.
2929 exit 0;
3030}
3131
3232my $queued = eval { $aa->discover } // 0;
3333my $fired = eval { $aa->fire_ready } // [];
3434
3535my $n_fired = scalar grep { $_->{action} eq 'sent' } @$fired;
3636my $n_skipped = scalar grep { $_->{action} eq 'skipped' } @$fired;
3737my $n_failed = scalar grep { $_->{action} eq 'failed' } @$fired;
3838
3939if ($queued || @$fired) {
4040 print "[$ts] queued=$queued fired=$n_fired skipped=$n_skipped failed=$n_failed\n";
4141 foreach my $line (@{ $aa->log_lines }) {
4242 print "[$ts] $line\n";
4343 }
4444}
4545
4646exit 0;