Skip to content

Commit

Permalink
fix: now archived features are not marked as stale anymore (#6149)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjaanus authored Feb 7, 2024
1 parent 71643f9 commit b9a8280
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/features/feature-toggle/feature-toggle-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ export default class FeatureToggleStore implements IFeatureToggleStore {
WHERE feature_types.id = features.type) *
INTERVAL '1 day'))) as current_staleness
FROM features
WHERE NOT stale = true`,
WHERE NOT stale = true AND archived_at IS NULL`,
[currentTime || this.db.fn.now()],
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,27 @@ describe('potentially_stale marking', () => {
expect(markedToggles).toStrictEqual([]);
});

test('it does not mark archived toggles potentially stale', async () => {
const features: FeatureToggleInsert[] = [
{
name: 'feature1',
type: 'release',
archived: true,
createdByUserId: 9999,
},
];
await Promise.all(
features.map((feature) =>
featureToggleStore.create('default', feature),
),
);
const markedToggles =
await featureToggleStore.updatePotentiallyStaleFeatures(
getFutureTimestamp(1000),
);
expect(markedToggles).toStrictEqual([]);
});

test('it does not return toggles previously marked as potentially_stale', async () => {
const features: FeatureToggleInsert[] = [
{
Expand Down

0 comments on commit b9a8280

Please sign in to comment.