fix(github): Reconcile entire GraphQL pages (#25311)

This commit is contained in:
Sergei Zharinov
2023-10-20 02:47:21 -03:00
committed by GitHub
parent 782e57302d
commit f19eff92ce
2 changed files with 9 additions and 5 deletions
@@ -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
@@ -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' },
@@ -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') },
},
});