Code Explainers

Code explainers tagged #fault-tolerance

ruby
class CircuitBreaker
  class OpenCircuitError < StandardError; end
 
  def initialize(failure_threshold: 5, reset_timeout: 30, half_open_max: 1)

How a circuit breaker guards failing calls

state-machine fault-tolerance concurrency
Advanced 9 steps
java
@Configuration
@EnableBatchProcessing
public class CustomerImportJobConfig {
 

How a chunk-based CSV import job works in Spring

batch-processing etl csv-parsing
Intermediate 9 steps
java
@Component
public class InventoryReconciliationJob {
 
    private static final Logger log = LoggerFactory.getLogger(InventoryReconciliationJob.class);

Distributed scheduled jobs with Spring locks

distributed-locking scheduling concurrency
Advanced 8 steps
typescript
import { Injectable, OnModuleInit, Logger } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { Cron, CronExpression } from '@nestjs/schedule';
 

A self-refreshing feature flags provider in NestJS

caching scheduled-tasks dependency-injection
Intermediate 8 steps
php
<?php
 
namespace App\Resilience;
 

How a circuit breaker guards a flaky service

circuit-breaker resilience caching
Intermediate 9 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