Skip to content
Source
Sign inSign up
pingdotgg/t3code

refactor(server): trace reusable domain operations #21996

Mergedjuliusmarmingemerged 6 commits intoeffect-fn/orchestration-services fromrefs/pull/21996/headmerged by juliusmarminge View on GitHub

Showing 45 changed files with 105 additions and 105 deletions (loading 42).

x
0 of 45 viewed, 45 left
11 additions and 10 deletionsapps/server/src/background/BackgroundPolicy.tsModified
View file
@@ -289,16 +289,17 @@
const hasDemand: BackgroundPolicy["Service"]["hasDemand"] = (scope) =>
Effect.map(snapshot, (current) => current.activeScopeKeys.includes(scopeKey(scope)));
​
- const shouldRunScopeWork: BackgroundPolicy["Service"]["shouldRunScopeWork"] = (scope) =>
- Effect.gen(function* () {
- const [current, settings] = yield* Effect.all([snapshot, backgroundActivitySettings]);
- if (isHostConstrained(current.hostPower, settings)) {
- return false;
- }
- return current.leases.some((lease) =>
- leaseMayRunScopedWork(lease, scope, current.updatedAt, settings),
- );
- });
+ const shouldRunScopeWork: BackgroundPolicy["Service"]["shouldRunScopeWork"] = Effect.fn(
+ "BackgroundPolicy.shouldRunScopeWork",
+ )(function* (scope) {
+ const [current, settings] = yield* Effect.all([snapshot, backgroundActivitySettings]);
+ if (isHostConstrained(current.hostPower, settings)) {
+ return false;
+ }
+ return current.leases.some((lease) =>
+ leaseMayRunScopedWork(lease, scope, current.updatedAt, settings),
+ );
+ });
​
const shouldRunOpportunisticWork = Effect.map(
snapshot,