Skip to content

Commit

Permalink
Catch and log cache clearing failures after deletion (safe-global#1094)
Browse files Browse the repository at this point in the history
This prevents locally triggered cache clearing after transaction deletion from throwing, instead logging a warning.
  • Loading branch information
iamacook authored Feb 1, 2024
1 parent 430a0e9 commit 0acd187
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/domain/safe/safe.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { TransferValidator } from '@/domain/safe/transfer.validator';
import { AddConfirmationDto } from '@/domain/transactions/entities/add-confirmation.dto.entity';
import { ProposeTransactionDto } from '@/domain/transactions/entities/propose-transaction.dto.entity';
import { getAddress } from 'viem';
import { ILoggingService, LoggingService } from '@/logging/logging.interface';

@Injectable()
export class SafeRepository implements ISafeRepository {
Expand All @@ -33,6 +34,7 @@ export class SafeRepository implements ISafeRepository {
private readonly transferValidator: TransferValidator,
private readonly moduleTransactionValidator: ModuleTransactionValidator,
private readonly creationTransactionValidator: CreationTransactionValidator,
@Inject(LoggingService) private readonly loggingService: ILoggingService,
) {}

async getSafe(args: { chainId: string; address: string }): Promise<Safe> {
Expand Down Expand Up @@ -296,7 +298,11 @@ export class SafeRepository implements ISafeRepository {
Promise.all([
transactionService.clearMultisigTransaction(args.safeTxHash),
transactionService.clearMultisigTransactions(safe),
]);
]).catch(() => {
this.loggingService.warn(
'Failed to immediately clear deleted transaction from cache',
);
});
}

async clearMultisigTransactions(args: {
Expand Down

0 comments on commit 0acd187

Please sign in to comment.