Skip to content

Commit

Permalink
purger: fix detection of failing purges
Browse files Browse the repository at this point in the history
!restart
  • Loading branch information
siddharthvp committed Jan 1, 2024
1 parent 991ae28 commit 0f5f92a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions eventstream-router/routes/purger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,13 @@ export default class Purger extends Route {

async executePurgeRequest(purgeParams: ApiPurgeParams) {
try {
await bot.request(purgeParams);
this.log(`[V] Purged titles ${purgeParams.titles}`);
this.log(`[+] Purged batch of ${purgeParams.titles.length} pages`);
const response = await bot.request(purgeParams);
const invalidPurges = response.purge.filter(r => r.invalid);
this.log(`[+] Purged batch of ${purgeParams.titles.length} pages` +
(invalidPurges.length ? `, of which ${invalidPurges.length} were invalid` : ''));
if (invalidPurges.length) {
this.log(`[E] Invalid purges: ${invalidPurges.map(e => e.title)}`);
}
await bot.sleep(2000); // Sleep interval between successive purges
} catch (e) {
this.log(`[V] Failed to purge titles ${purgeParams.titles}`);
Expand Down

0 comments on commit 0f5f92a

Please sign in to comment.