fix: add caching for defaultUA db call and code fixes
This commit is contained in:
1 parent
babe5ae177
commit
023cf5782d
13 files changed
+89
-19
No files matched your search
@@ -132,7 +132,15 @@ export class SuperSimpleQueueHelper implements ISuperSimpleQueueHelper {
|
||||
}
|
||||
|
||||
// Step 2. Request monitor status
|
||||
const status = await this.networkService.requestStatus(monitor);
|
||||
// Resolve default user agent for HTTP monitors (cached, invalidated on settings update)
|
||||
let effectiveMonitor: Monitor = monitor;
|
||||
if (monitor.type === "http" && !monitor.customUserAgent) {
|
||||
const defaultUserAgent = await this.settingsService.getDefaultUserAgent();
|
||||
if (defaultUserAgent) {
|
||||
effectiveMonitor = { ...monitor, customUserAgent: defaultUserAgent };
|
||||
}
|
||||
}
|
||||
const status = await this.networkService.requestStatus(effectiveMonitor);
|
||||
if (!status) {
|
||||
throw new Error("No network response");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user