fix(managed): read the wanderer as off on managed, keep the replica alerts mutable, and drop dead guards

This commit is contained in:
Maurice
2026-11-05 13:02:27 +01:00
parent 887f5d8c84
commit 7743e4da16
6 changed files with 65 additions and 23 deletions
+6 -1
View File
@@ -120,8 +120,13 @@ export class AddonsService {
return this.photoProviders.listEnabledIds();
}
/** wanderer may be used: Tours is on and the admin allowed it under Tours. */
/**
* wanderer may be used: Tours is on and the admin allowed it under Tours. Never on a managed
* install, where it would send searches to a server the user picks; the admin switch is locked
* there, so a value stored before the install became managed must not keep it on.
*/
async isWandererAvailable(): Promise<boolean> {
if (readEnv().managed.enabled) return false;
return (await this.isAddonEnabled(ADDON_IDS.TOURS)) && (await this.getToursWanderer()).enabled;
}
@@ -1,5 +1,6 @@
import { withRequestContext } from '../database/request-context';
import { StorageEventsService } from '../storage/storage-events.service';
import { offeredEventTypes } from './notification-preferences.service';
import { NotificationsService } from './notifications.service';
import { ReplicaFailureDebouncer } from './replica-failure-debouncer';
import { MikroORM } from '@mikro-orm/core';
@@ -44,8 +45,19 @@ export class StorageHealthNotifierService implements OnApplicationBootstrap {
onApplicationBootstrap(): void {
this.events.onReplicaFailure((failure) => {
// On a managed install the replicas are the operator's, and the
// preference matrix has no row to mute this event, so the admins there
// would get alerts they can neither act on nor switch off. The warning
// keeps the failure in the operator's logs, behind the same debounce so
// an outage is one line an hour per backend rather than one per write.
const suppressed = this.debouncer.admit(failure.backend);
if (suppressed === null) return;
if (!offeredEventTypes().includes('replica_failure')) {
this.logger.warn(
`replica ${failure.op} failed on ${failure.backend}: ${failure.error} (${suppressed} suppressed)`,
);
return;
}
const sendNotification = () =>
this.notifications
.send({