Skip to content

Commit

Permalink
fix(github): Reconcile entire GraphQL pages (#25311)
Browse files Browse the repository at this point in the history
  • Loading branch information
zharinov committed Oct 20, 2023
1 parent 782e573 commit f19eff9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Expand Up @@ -110,9 +110,13 @@ export abstract class AbstractGithubGraphqlCacheStrategy<

// If we reached previously stored item that is stabilized,
// we assume the further pagination will not yield any new items.
//
// However, we don't break the loop here, allowing to reconcile
// the entire page of items. This protects us from unusual cases
// when release authors intentionally break the timeline. Therefore,
// while it feels appealing to break early, please don't do that.
if (oldItem && this.isStabilized(oldItem)) {
isPaginationDone = true;
break;
}

// Check if item is new or updated
Expand Down
Expand Up @@ -133,7 +133,7 @@ describe('util/github/graphql/cache-strategies/memory-cache-strategy', () => {
expect(isPaginationDone).toBe(true);
});

it('reconciles only not stabilized items in page', async () => {
it('reconciles entire page', async () => {
const oldItems = {
'1': { releaseTimestamp: isoTs('2020-01-01 00:00'), version: '1' },
'2': { releaseTimestamp: isoTs('2020-01-01 01:00'), version: '2' },
Expand Down Expand Up @@ -161,9 +161,9 @@ describe('util/github/graphql/cache-strategies/memory-cache-strategy', () => {
expect(isPaginationDone).toBe(true);
expect(memCache.get('github-graphql-cache:foo:bar')).toMatchObject({
items: {
'1': { releaseTimestamp: isoTs('2020-01-01 00:00') },
'2': { releaseTimestamp: isoTs('2020-01-01 01:00') },
'3': { releaseTimestamp: isoTs('2020-01-01 02:00') },
'1': { releaseTimestamp: isoTs('2022-12-31 10:00') },
'2': { releaseTimestamp: isoTs('2022-12-31 11:00') },
'3': { releaseTimestamp: isoTs('2022-12-31 12:00') },
'4': { releaseTimestamp: isoTs('2022-12-31 13:00') },
},
});
Expand Down

0 comments on commit f19eff9

Please sign in to comment.