diff --git a/api/src/services/listing.service.ts b/api/src/services/listing.service.ts index 4e950a34e0..2d31f831c8 100644 --- a/api/src/services/listing.service.ts +++ b/api/src/services/listing.service.ts @@ -1286,19 +1286,23 @@ export class ListingService implements OnModuleInit { this.httpService.request({ baseURL: process.env.PROXY_URL, method: 'PURGE', - url: shouldPurgeAllListings - ? '/listings?*' - : `/listings/${savedResponseId}*`, + url: `/listings/${savedResponseId}*`, }), undefined, ).catch((e) => - console.error( - shouldPurgeAllListings - ? 'purge all listings error = ' - : `purge listing ${savedResponseId} error = `, - e, - ), + console.error(`purge listing ${savedResponseId} error = `, e), ); + + if (shouldPurgeAllListings) { + await firstValueFrom( + this.httpService.request({ + baseURL: process.env.PROXY_URL, + method: 'PURGE', + url: '/listings?*', + }), + undefined, + ).catch((e) => console.error('purge all listings error = ', e)); + } } /*