feat: deliver maintenance notice batches
parent
cbd4798f4c
commit
0375c0fa4c
@ -0,0 +1,24 @@
|
||||
[Unit]
|
||||
Description=Virt Cloud maintenance notification worker
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=apache
|
||||
Group=apache
|
||||
WorkingDirectory=/home/virt-cloud/web
|
||||
ExecStart=/usr/bin/php /home/virt-cloud/web/xcat cloudWorker --notification-only
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
UMask=0077
|
||||
NoNewPrivileges=true
|
||||
PrivateTmp=true
|
||||
ProtectHome=false
|
||||
ProtectSystem=strict
|
||||
ReadWritePaths=-/home/virt-cloud/runtime/php
|
||||
ReadWritePaths=-/home/virt-cloud/web/storage
|
||||
TimeoutStopSec=30
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@ -0,0 +1,255 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Cloud;
|
||||
|
||||
use App\Models\CloudMaintenanceNotice;
|
||||
use App\Models\CloudMaintenanceNoticeInstance;
|
||||
use App\Models\CloudMaintenanceNoticeRecipient;
|
||||
use App\Models\User;
|
||||
use App\Services\Mail;
|
||||
use Illuminate\Database\Capsule\Manager as DB;
|
||||
|
||||
/** Leased, one-at-a-time maintenance mail delivery with no unknown replay. */
|
||||
final class CloudMaintenanceNoticeDeliveryService
|
||||
{
|
||||
private const LEASE_SECONDS = 300;
|
||||
private const EXPIRED_LEASE_LIMIT = 10;
|
||||
|
||||
private readonly \Closure $clock;
|
||||
private readonly \Closure $sender;
|
||||
private readonly \Closure $blacklist;
|
||||
|
||||
public function __construct(?callable $sender = null,
|
||||
?callable $blacklist = null, ?callable $clock = null,
|
||||
private readonly CloudMaintenanceNoticeService $notices =
|
||||
new CloudMaintenanceNoticeService())
|
||||
{
|
||||
$this->clock = \Closure::fromCallable($clock
|
||||
?? static fn (): int => time());
|
||||
$this->sender = \Closure::fromCallable($sender
|
||||
?? static fn (string $to, string $subject, array $variables): bool =>
|
||||
Mail::send(
|
||||
$to,
|
||||
$subject,
|
||||
'cloud/maintenance-notice.tpl',
|
||||
$variables,
|
||||
[],
|
||||
'maintenance_notice'
|
||||
));
|
||||
$this->blacklist = \Closure::fromCallable($blacklist
|
||||
?? static fn (string $email): bool =>
|
||||
Mail::isRecipientBlacklisted($email));
|
||||
}
|
||||
|
||||
public function tick(): bool
|
||||
{
|
||||
$worked = $this->convergeExpiredLeases();
|
||||
$claim = $this->claim();
|
||||
if ($claim === null) {
|
||||
return $worked;
|
||||
}
|
||||
if (isset($claim['settled_notice_id'])) {
|
||||
$this->notices->recalculate((int) $claim['settled_notice_id']);
|
||||
return true;
|
||||
}
|
||||
|
||||
$recipient = $claim['recipient'];
|
||||
$token = $claim['lease_token'];
|
||||
$recipientId = (int) $recipient->id;
|
||||
$noticeId = (int) $recipient->notice_id;
|
||||
try {
|
||||
if (!User::where('id', (int) $recipient->user_id)->exists()) {
|
||||
$this->finalize($recipientId, $noticeId, $token,
|
||||
'skipped', 'user_deleted', '');
|
||||
return true;
|
||||
}
|
||||
if (($this->blacklist)((string) $recipient->email_snapshot)) {
|
||||
$this->finalize($recipientId, $noticeId, $token,
|
||||
'skipped', 'recipient_blacklisted', '');
|
||||
return true;
|
||||
}
|
||||
$mail = $this->mail($recipient);
|
||||
} catch (\Throwable $error) {
|
||||
$this->finalize($recipientId, $noticeId, $token,
|
||||
'failed', 'delivery_preflight_failed', get_class($error));
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
$accepted = ($this->sender)(
|
||||
(string) $recipient->email_snapshot,
|
||||
(string) $mail['subject'],
|
||||
$mail['variables']
|
||||
) === true;
|
||||
} catch (\Throwable $error) {
|
||||
$this->finalize($recipientId, $noticeId, $token,
|
||||
'unknown', 'delivery_effect_unknown', get_class($error));
|
||||
return true;
|
||||
}
|
||||
$this->finalize(
|
||||
$recipientId,
|
||||
$noticeId,
|
||||
$token,
|
||||
$accepted ? 'sent' : 'unknown',
|
||||
$accepted ? '' : 'delivery_effect_unknown',
|
||||
''
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
private function claim(): ?array
|
||||
{
|
||||
return DB::connection('default')->transaction(function (): ?array {
|
||||
$now = $this->now();
|
||||
$recipient = CloudMaintenanceNoticeRecipient::where(
|
||||
'status', 'pending'
|
||||
)->where('available_at', '<=', $now)->orderBy('available_at')
|
||||
->orderBy('id')->lockForUpdate()->first();
|
||||
if ($recipient === null) {
|
||||
return null;
|
||||
}
|
||||
$notice = CloudMaintenanceNotice::where(
|
||||
'id', $recipient->notice_id
|
||||
)->lockForUpdate()->first();
|
||||
if ($notice === null || !in_array((string) $notice->status,
|
||||
['scheduled', 'sending'], true)) {
|
||||
$recipient->status = 'cancelled';
|
||||
$recipient->last_error_code = 'notice_not_deliverable';
|
||||
$recipient->last_error = '';
|
||||
$recipient->updated_at = $now;
|
||||
$recipient->save();
|
||||
return ['settled_notice_id' => (int) $recipient->notice_id];
|
||||
}
|
||||
$token = bin2hex(random_bytes(16));
|
||||
$recipient->status = 'sending';
|
||||
$recipient->attempts = (int) $recipient->attempts + 1;
|
||||
$recipient->lease_token = $token;
|
||||
$recipient->lease_until = $now + self::LEASE_SECONDS;
|
||||
$recipient->last_error_code = '';
|
||||
$recipient->last_error = '';
|
||||
$recipient->updated_at = $now;
|
||||
if (!$recipient->save()) {
|
||||
throw new \RuntimeException('Maintenance recipient claim failed.');
|
||||
}
|
||||
if ((string) $notice->status === 'scheduled') {
|
||||
$notice->status = 'sending';
|
||||
$notice->updated_at = $now;
|
||||
$notice->save();
|
||||
}
|
||||
return ['recipient' => $recipient, 'lease_token' => $token];
|
||||
}, 3);
|
||||
}
|
||||
|
||||
private function convergeExpiredLeases(): bool
|
||||
{
|
||||
$noticeIds = DB::connection('default')->transaction(function (): array {
|
||||
$now = $this->now();
|
||||
$rows = CloudMaintenanceNoticeRecipient::where('status', 'sending')
|
||||
->where('lease_until', '>', 0)
|
||||
->where('lease_until', '<=', $now)
|
||||
->orderBy('lease_until')->orderBy('id')
|
||||
->limit(self::EXPIRED_LEASE_LIMIT)->lockForUpdate()->get();
|
||||
$noticeIds = [];
|
||||
foreach ($rows as $row) {
|
||||
$updated = CloudMaintenanceNoticeRecipient::where('id', $row->id)
|
||||
->where('status', 'sending')
|
||||
->where('lease_token', $row->lease_token)->update([
|
||||
'status' => 'unknown',
|
||||
'lease_token' => null,
|
||||
'lease_until' => 0,
|
||||
'last_error_code' => 'delivery_lease_expired',
|
||||
'last_error' => '',
|
||||
'updated_at' => $now,
|
||||
]);
|
||||
if ($updated === 1) {
|
||||
$noticeIds[(int) $row->notice_id] = true;
|
||||
}
|
||||
}
|
||||
return array_keys($noticeIds);
|
||||
}, 3);
|
||||
foreach ($noticeIds as $noticeId) {
|
||||
$this->notices->recalculate((int) $noticeId);
|
||||
}
|
||||
return $noticeIds !== [];
|
||||
}
|
||||
|
||||
private function mail(CloudMaintenanceNoticeRecipient $recipient): array
|
||||
{
|
||||
$notice = CloudMaintenanceNotice::where(
|
||||
'id', $recipient->notice_id
|
||||
)->first();
|
||||
if ($notice === null) {
|
||||
throw new \RuntimeException('Maintenance notice is missing.');
|
||||
}
|
||||
$scope = json_decode((string) $notice->scope_snapshot_json,
|
||||
true, 32, JSON_THROW_ON_ERROR);
|
||||
if (!is_array($scope) || !is_string($scope['label'] ?? null)) {
|
||||
throw new \RuntimeException('Maintenance scope is invalid.');
|
||||
}
|
||||
$instances = CloudMaintenanceNoticeInstance::where(
|
||||
'notice_id', $notice->id
|
||||
)->where('user_id', $recipient->user_id)->orderBy('id')->get()
|
||||
->map(static fn ($instance): array => [
|
||||
'name' => (string) $instance->instance_name,
|
||||
'ipv4' => (string) $instance->ipv4,
|
||||
'ipv6' => (string) $instance->ipv6,
|
||||
])->all();
|
||||
if ($instances === []) {
|
||||
throw new \RuntimeException('Maintenance instance list is empty.');
|
||||
}
|
||||
$impacts = [
|
||||
'network_interruption' => '网络可能短时中断',
|
||||
'instance_restart' => '实例将重新启动',
|
||||
'service_interruption' => '服务可能短时中断',
|
||||
'no_interruption' => '预计不会中断服务',
|
||||
];
|
||||
$impact = $impacts[(string) $notice->impact] ?? null;
|
||||
if ($impact === null) {
|
||||
throw new \RuntimeException('Maintenance impact is invalid.');
|
||||
}
|
||||
return [
|
||||
'subject' => (string) $notice->subject,
|
||||
'variables' => [
|
||||
'notice_subject' => (string) $notice->subject,
|
||||
'message_text' => (string) $notice->message_text,
|
||||
'scope_label' => (string) $scope['label'],
|
||||
'impact_label' => $impact,
|
||||
'maintenance_starts_utc' => gmdate(
|
||||
'Y-m-d H:i:s \\U\\T\\C',
|
||||
(int) $notice->maintenance_starts_at
|
||||
),
|
||||
'maintenance_ends_utc' => gmdate(
|
||||
'Y-m-d H:i:s \\U\\T\\C',
|
||||
(int) $notice->maintenance_ends_at
|
||||
),
|
||||
'instances' => $instances,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
private function finalize(int $recipientId, int $noticeId,
|
||||
string $token, string $status, string $errorCode,
|
||||
string $error): void
|
||||
{
|
||||
$now = $this->now();
|
||||
$updated = CloudMaintenanceNoticeRecipient::where('id', $recipientId)
|
||||
->where('status', 'sending')->where('lease_token', $token)
|
||||
->update([
|
||||
'status' => $status,
|
||||
'lease_token' => null,
|
||||
'lease_until' => 0,
|
||||
'sent_at' => $status === 'sent' ? $now : null,
|
||||
'last_error_code' => $errorCode,
|
||||
'last_error' => mb_substr($error, 0, 500),
|
||||
'updated_at' => $now,
|
||||
]);
|
||||
if ($updated === 1) {
|
||||
$this->notices->recalculate($noticeId);
|
||||
}
|
||||
}
|
||||
|
||||
private function now(): int
|
||||
{
|
||||
return (int) ($this->clock)();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
$root = dirname(__DIR__);
|
||||
$deletion = file_get_contents(
|
||||
$root . '/app/Services/UserDataDeletionService.php'
|
||||
);
|
||||
$assert = static function (bool $condition, string $message): void {
|
||||
if (!$condition) {
|
||||
throw new RuntimeException($message);
|
||||
}
|
||||
};
|
||||
|
||||
$assert(str_contains($deletion,
|
||||
"['cloud_maintenance_notice_recipients', 'user_id']")
|
||||
&& str_contains($deletion,
|
||||
"['cloud_maintenance_notice_instances', 'user_id']"),
|
||||
'Account deletion does not remove frozen maintenance recipient data.');
|
||||
$assert(str_contains($deletion,
|
||||
"(string) \$recipient->status === 'sending'")
|
||||
&& str_contains($deletion,
|
||||
'投递中的维护通知'),
|
||||
'Account deletion can erase an in-flight maintenance delivery.');
|
||||
$assert(str_contains($deletion,
|
||||
'$noticeService->recalculate((int) $noticeId);'),
|
||||
'Account deletion does not reconcile affected notice aggregates.');
|
||||
|
||||
echo "Maintenance notice account-deletion contracts passed.\n";
|
||||
@ -0,0 +1,224 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
require dirname(__DIR__) . '/vendor/autoload.php';
|
||||
|
||||
use App\Services\Cloud\CloudMaintenanceNoticeDeliveryService;
|
||||
use App\Services\Cloud\CloudMaintenanceNoticeAudience;
|
||||
use App\Services\Cloud\CloudMaintenanceNoticeService;
|
||||
use Illuminate\Database\Capsule\Manager as Capsule;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
$assert = static function (bool $condition, string $message): void {
|
||||
if (!$condition) {
|
||||
throw new RuntimeException($message);
|
||||
}
|
||||
};
|
||||
$capsule = new Capsule();
|
||||
$capsule->addConnection([
|
||||
'driver' => 'sqlite', 'database' => ':memory:',
|
||||
], 'default');
|
||||
$capsule->setAsGlobal();
|
||||
$capsule->bootEloquent();
|
||||
$schema = $capsule->schema('default');
|
||||
|
||||
$schema->create('user', static function (Blueprint $table): void {
|
||||
$table->increments('id');
|
||||
$table->string('email');
|
||||
});
|
||||
$schema->create('cloud_maintenance_notices', static function (Blueprint $table): void {
|
||||
$table->increments('id');
|
||||
$table->string('notice_key');
|
||||
$table->integer('requested_by_user_id');
|
||||
$table->string('request_idempotency_key');
|
||||
$table->string('request_fingerprint');
|
||||
$table->string('scope_type');
|
||||
$table->integer('scope_id');
|
||||
$table->text('scope_snapshot_json');
|
||||
$table->string('subject');
|
||||
$table->text('message_text');
|
||||
$table->string('impact');
|
||||
$table->integer('maintenance_starts_at');
|
||||
$table->integer('maintenance_ends_at');
|
||||
$table->integer('scheduled_at');
|
||||
$table->string('audience_digest');
|
||||
$table->integer('instance_count');
|
||||
$table->integer('recipient_count');
|
||||
$table->integer('skipped_count');
|
||||
$table->string('status');
|
||||
$table->string('last_error_code');
|
||||
$table->integer('terminal_at')->nullable();
|
||||
$table->integer('created_at');
|
||||
$table->integer('updated_at');
|
||||
});
|
||||
$schema->create('cloud_maintenance_notice_instances', static function (Blueprint $table): void {
|
||||
$table->increments('id');
|
||||
$table->integer('notice_id');
|
||||
$table->integer('instance_id');
|
||||
$table->integer('user_id');
|
||||
$table->integer('host_id');
|
||||
$table->integer('public_ip_pool_id')->nullable();
|
||||
$table->string('instance_name');
|
||||
$table->string('ipv4');
|
||||
$table->string('ipv6');
|
||||
$table->text('evidence_json');
|
||||
$table->integer('created_at');
|
||||
});
|
||||
$schema->create('cloud_maintenance_notice_recipients', static function (Blueprint $table): void {
|
||||
$table->increments('id');
|
||||
$table->integer('notice_id');
|
||||
$table->integer('user_id');
|
||||
$table->string('email_snapshot');
|
||||
$table->string('status');
|
||||
$table->integer('attempts');
|
||||
$table->integer('available_at');
|
||||
$table->string('lease_token')->nullable();
|
||||
$table->integer('lease_until');
|
||||
$table->integer('sent_at')->nullable();
|
||||
$table->string('last_error_code');
|
||||
$table->string('last_error');
|
||||
$table->integer('created_at');
|
||||
$table->integer('updated_at');
|
||||
});
|
||||
|
||||
$now = 1793900000;
|
||||
Capsule::table('user')->insert([
|
||||
['id' => 1, 'email' => 'ok@example.com'],
|
||||
['id' => 2, 'email' => 'unknown@example.com'],
|
||||
['id' => 3, 'email' => 'blocked@example.com'],
|
||||
]);
|
||||
$insertNotice = static function (int $id, string $status = 'scheduled') use ($now): void {
|
||||
Capsule::table('cloud_maintenance_notices')->insert([
|
||||
'id' => $id, 'notice_key' => str_pad(dechex($id), 32, '0', STR_PAD_LEFT),
|
||||
'requested_by_user_id' => 9,
|
||||
'request_idempotency_key' => 'delivery-test-' . str_pad((string) $id, 4, '0', STR_PAD_LEFT),
|
||||
'request_fingerprint' => str_repeat('a', 64),
|
||||
'scope_type' => 'host', 'scope_id' => 1,
|
||||
'scope_snapshot_json' => '{"label":"HKG-A"}',
|
||||
'subject' => 'Maintenance <notice>', 'message_text' => 'Please save.',
|
||||
'impact' => 'network_interruption',
|
||||
'maintenance_starts_at' => $now + 3600,
|
||||
'maintenance_ends_at' => $now + 7200,
|
||||
'scheduled_at' => $now, 'audience_digest' => str_repeat('b', 64),
|
||||
'instance_count' => 1, 'recipient_count' => 1, 'skipped_count' => 0,
|
||||
'status' => $status, 'last_error_code' => '', 'terminal_at' => null,
|
||||
'created_at' => $now, 'updated_at' => $now,
|
||||
]);
|
||||
};
|
||||
$insertRecipient = static function (int $id, int $noticeId, int $userId,
|
||||
string $email, string $status, int $availableAt,
|
||||
?string $token = null, int $leaseUntil = 0) use ($now): void {
|
||||
Capsule::table('cloud_maintenance_notice_recipients')->insert([
|
||||
'id' => $id, 'notice_id' => $noticeId, 'user_id' => $userId,
|
||||
'email_snapshot' => $email, 'status' => $status,
|
||||
'attempts' => $status === 'sending' ? 1 : 0,
|
||||
'available_at' => $availableAt, 'lease_token' => $token,
|
||||
'lease_until' => $leaseUntil, 'sent_at' => null,
|
||||
'last_error_code' => '', 'last_error' => '',
|
||||
'created_at' => $now, 'updated_at' => $now,
|
||||
]);
|
||||
Capsule::table('cloud_maintenance_notice_instances')->insert([
|
||||
'notice_id' => $noticeId, 'instance_id' => 100 + $noticeId,
|
||||
'user_id' => $userId, 'host_id' => 1,
|
||||
'public_ip_pool_id' => null, 'instance_name' => 'vm-' . $noticeId,
|
||||
'ipv4' => '203.0.113.' . $noticeId,
|
||||
'ipv6' => '2001:db8::' . $noticeId,
|
||||
'evidence_json' => '{}', 'created_at' => $now,
|
||||
]);
|
||||
};
|
||||
|
||||
$insertNotice(1);
|
||||
$insertRecipient(1, 1, 1, 'ok@example.com', 'pending', $now);
|
||||
$insertRecipient(2, 1, 2, 'unknown@example.com', 'pending', $now + 60);
|
||||
$sent = [];
|
||||
$delivery = new CloudMaintenanceNoticeDeliveryService(
|
||||
static function (string $to, string $subject, array $variables) use (&$sent): bool {
|
||||
$sent[] = compact('to', 'subject', 'variables');
|
||||
return $to === 'ok@example.com';
|
||||
},
|
||||
static fn (string $email): bool => $email === 'blocked@example.com',
|
||||
static fn (): int => $now,
|
||||
new CloudMaintenanceNoticeService(
|
||||
new CloudMaintenanceNoticeAudience(),
|
||||
static fn (): int => $now
|
||||
)
|
||||
);
|
||||
$assert($delivery->tick() === true && count($sent) === 1,
|
||||
'One due recipient must be delivered per tick.');
|
||||
$row = Capsule::table('cloud_maintenance_notice_recipients')->find(1);
|
||||
$assert($row->status === 'sent' && (int) $row->attempts === 1
|
||||
&& (int) $row->sent_at === $now,
|
||||
'Accepted mail was not finalized exactly once.');
|
||||
$assert($sent[0]['variables']['maintenance_starts_utc']
|
||||
=== gmdate('Y-m-d H:i:s \\U\\T\\C', $now + 3600)
|
||||
&& $sent[0]['variables']['instances'][0]['ipv6'] === '2001:db8::1',
|
||||
'Delivery lost the frozen UTC window or recipient instance list.');
|
||||
$assert($delivery->tick() === false && count($sent) === 1,
|
||||
'A future recipient was delivered early.');
|
||||
|
||||
Capsule::table('cloud_maintenance_notice_recipients')->where('id', 2)
|
||||
->update(['available_at' => $now]);
|
||||
$assert($delivery->tick() === true && count($sent) === 2,
|
||||
'The second due recipient was not attempted.');
|
||||
$row = Capsule::table('cloud_maintenance_notice_recipients')->find(2);
|
||||
$notice = Capsule::table('cloud_maintenance_notices')->find(1);
|
||||
$assert($row->status === 'unknown'
|
||||
&& $row->last_error_code === 'delivery_effect_unknown'
|
||||
&& $notice->status === 'attention',
|
||||
'A transport false result was not preserved as unknown attention.');
|
||||
$assert($delivery->tick() === false && count($sent) === 2,
|
||||
'An unknown delivery was replayed automatically.');
|
||||
|
||||
$insertNotice(2, 'sending');
|
||||
$insertRecipient(3, 2, 1, 'expired@example.com', 'sending',
|
||||
$now - 400, str_repeat('c', 32), $now - 1);
|
||||
$assert($delivery->tick() === true && count($sent) === 2,
|
||||
'An expired sending lease was not converged without transport.');
|
||||
$row = Capsule::table('cloud_maintenance_notice_recipients')->find(3);
|
||||
$assert($row->status === 'unknown'
|
||||
&& $row->last_error_code === 'delivery_lease_expired',
|
||||
'Expired lease was retried or lost its unknown-effect evidence.');
|
||||
|
||||
$insertNotice(3);
|
||||
$insertRecipient(4, 3, 3, 'blocked@example.com', 'pending', $now);
|
||||
$assert($delivery->tick() === true && count($sent) === 2,
|
||||
'A blacklisted recipient did not settle without transport.');
|
||||
$row = Capsule::table('cloud_maintenance_notice_recipients')->find(4);
|
||||
$notice = Capsule::table('cloud_maintenance_notices')->find(3);
|
||||
$assert($row->status === 'skipped'
|
||||
&& $row->last_error_code === 'recipient_blacklisted'
|
||||
&& $notice->status === 'completed',
|
||||
'Blacklisted delivery was sent or aggregated as a failure.');
|
||||
|
||||
$insertNotice(4);
|
||||
$insertRecipient(5, 4, 99, 'deleted@example.com', 'pending', $now);
|
||||
$assert($delivery->tick() === true && count($sent) === 2
|
||||
&& Capsule::table('cloud_maintenance_notice_recipients')->find(5)
|
||||
->status === 'skipped',
|
||||
'A deleted user still reached the transport.');
|
||||
|
||||
$insertNotice(5);
|
||||
$insertRecipient(6, 5, 1, 'fenced@example.com', 'pending', $now);
|
||||
$fenced = new CloudMaintenanceNoticeDeliveryService(
|
||||
static function (): bool {
|
||||
Capsule::table('cloud_maintenance_notice_recipients')
|
||||
->where('id', 6)->update([
|
||||
'status' => 'unknown', 'lease_token' => null,
|
||||
'lease_until' => 0,
|
||||
'last_error_code' => 'external_reconciliation',
|
||||
]);
|
||||
return true;
|
||||
},
|
||||
static fn (): bool => false,
|
||||
static fn (): int => $now,
|
||||
new CloudMaintenanceNoticeService(
|
||||
new CloudMaintenanceNoticeAudience(),
|
||||
static fn (): int => $now
|
||||
)
|
||||
);
|
||||
$assert($fenced->tick() === true
|
||||
&& Capsule::table('cloud_maintenance_notice_recipients')->find(6)
|
||||
->status === 'unknown',
|
||||
'A stale lease token overwrote a reconciled terminal outcome.');
|
||||
|
||||
echo "Maintenance notice delivery tests passed.\n";
|
||||
Loading…
Reference in New Issue