Code Explainers
Code explainers tagged #retry
java
@Configuration public class PaymentGatewayClientConfig { @Bean
Building a resilient RestClient in Spring
retry
http-client
backoff
Intermediate
9 steps
java
public final class RetryExecutor { private final int maxAttempts; private final Duration baseDelay;
Retry with exponential backoff in Java
retry
exponential-backoff
jitter
Intermediate
7 steps
python
import functools import time from flask import current_app
Retrying deadlocked DB writes in Flask
decorators
retry
exponential-backoff
Intermediate
6 steps
java
@Component @RequiredArgsConstructor @Slf4j public class FailedJobReprocessor {
Retrying failed jobs on a Spring schedule
scheduling
retry
exponential-backoff
Intermediate
10 steps
typescript
type RetryableRequest<T> = () => Promise<T>; interface RetryOptions { maxAttempts?: number;
Retrying HTTP requests with backoff
retry
exponential-backoff
error-handling
Intermediate
8 steps
ruby
class Document < ApplicationRecord class StaleObjectError < StandardError def initialize(id) super("Document ##{id} was modified by another process")
Optimistic locking with retries in Rails
optimistic-locking
concurrency
transactions
Advanced
8 steps
java
@Configuration @EnableKafka public class KafkaErrorHandlingConfig {
Kafka retry and dead-letter handling in Spring
kafka
error-handling
retry
Intermediate
7 steps
java
@Component public class OrderRecoveryHandler { private final RabbitTemplate rabbitTemplate;
Dead-letter recovery with Spring AMQP
dead-letter-queue
retry
exponential-backoff
Advanced
9 steps
typescript
type QueuedRequest = { id: string; url: string; method: string;
A retry queue with exponential backoff
retry
exponential-backoff
persistence
Intermediate
10 steps
php
public function transaction(callable $callback, int $maxAttempts = 3): mixed { $attempt = 0;
Retrying database deadlocks in PHP
retry
transactions
deadlock
Intermediate
8 steps
typescript
import { HttpService } from '@nestjs/axios'; import { Injectable, Logger, ServiceUnavailableException } from '@nestjs/common'; import { AxiosError } from 'axios'; import { catchError, firstValueFrom, retry, timer } from 'rxjs';
Resilient payment retries in NestJS
retry
exponential-backoff
rxjs
Advanced
8 steps
java
@Service public class PaymentGatewayClient { private static final Logger log = LoggerFactory.getLogger(PaymentGatewayClient.class);
Resilient payment calls in Spring
circuit breaker
retry
fault tolerance
Intermediate
7 steps
javascript
const DEFAULT_OPTIONS = { method: 'GET', timeout: 5000, retries: 3,
A resilient fetch wrapper with retries and timeout
fetch
retry
timeout
Intermediate
8 steps
go
package httpx import ( "net/http"
A retrying HTTP transport in Go
http
middleware
retry
Intermediate
8 steps
rust
use std::time::Duration; use tokio::time::sleep; #[derive(Debug)]
Async retry with exponential backoff in Rust
retry
exponential-backoff
async
Intermediate
8 steps
java
public final class RetryExecutor { private final int maxAttempts; private final Duration initialDelay;
Exponential backoff retry in Java
retry
exponential-backoff
jitter
Intermediate
8 steps
java
@Service public class PaymentGatewayClient { private static final Logger log = LoggerFactory.getLogger(PaymentGatewayClient.class);
Resilient payment calls with Spring Retry
retry
backoff
fault-tolerance
Intermediate
7 steps
javascript
const RETRIABLE_STATUS = new Set([408, 429, 500, 502, 503, 504]); function sleep(ms, signal) { return new Promise((resolve, reject) => {
Retrying fetch with exponential backoff
retry
exponential-backoff
abort-signal
Advanced
8 steps