GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(server): pull request checks expire from when they were observed · pingdotgg/t3code@f3f2bf0

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/server/src/pullRequest
    • PullRequestService.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/server/src/pullRequest/PullRequestService.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/pullRequest/PullRequestService.ts
+16-5Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2980,7 +2980,20 @@ export const make = Effect.gen(function* () {
29802980
},
29812981
{
29822982
capacity: DETAIL_CACHE_CAPACITY,
2983-
timeToLive: (exit) => (Exit.isSuccess(exit) ? CHECKS_CACHE_TTL : Duration.zero),
2983+
// Expire from the read's start so checks seeded from a slow detail read keep their age.
2984+
timeToLive: (exit) =>
2985+
!Exit.isSuccess(exit)
2986+
? Duration.zero
2987+
: exit.value === null
2988+
? CHECKS_CACHE_TTL
2989+
: Duration.millis(
2990+
Math.max(
2991+
0,
2992+
exit.value.observedAt +
2993+
Duration.toMillis(CHECKS_CACHE_TTL) -
2994+
clock.currentTimeMillisUnsafe(),
2995+
),
2996+
),
29842997
},
29852998
);
29862999

@@ -3014,12 +3027,10 @@ export const make = Effect.gen(function* () {
30143027
return detailUncached(refOfCacheKey(key)).pipe(
30153028
Effect.tap(
30163029
Effect.fn("PullRequestService.recordDetailStats")(function* (value: PullRequestDetail) {
3017-
// GitHub detail includes the same checks; seed only fresh reads at their shorter TTL.
3018-
const now = yield* Clock.currentTimeMillis;
3030+
// GitHub detail includes the same checks; the checks TTL counts from their observation.
30193031
if (
30203032
value.provider === "github" &&
30213033
value.observedAt !== undefined &&
3022-
now - value.observedAt < Duration.toMillis(CHECKS_CACHE_TTL) &&
30233034
!(yield* Cache.has(checksCache, key))
30243035
) {
30253036
yield* Cache.set(checksCache, key, {
@@ -3037,7 +3048,7 @@ export const make = Effect.gen(function* () {
30373048
additions: value.additions,
30383049
deletions: value.deletions,
30393050
},
3040-
now,
3051+
yield* Clock.currentTimeMillis,
30413052
);
30423053
}),
30433054
),

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.