go
package retry

import (
  "context"
  "math/rand"
  "time"

Exponential backoff with jitter for retries

go reliability retry
by Leah Thompson 1 tab
go
package deps

import (
  "context"
  "net/http"

Token bucket rate limiter for outbound calls

go rate-limit http
by Leah Thompson 1 tab
go
package pool

import "context"

type Job func(ctx context.Context) error

Bounded worker pool with backpressure

go concurrency worker-pool
by Leah Thompson 1 tab
go
package service

import (
  "context"

  "golang.org/x/sync/errgroup"

Fan-out with errgroup and shared cancellation

go concurrency context
by Leah Thompson 1 tab
go
package main

import (
  "context"
  "log"
  "net/http"

Graceful shutdown: draining HTTP + background workers

go http shutdown
by Leah Thompson 1 tab
go
        package api

        import (
          "context"
          "crypto/rand"
          "encoding/hex"

HTTP handler with timeouts, request IDs, and context cancellation

go http context
by Leah Thompson 2 tabs
python
import os
from .base import *

DEBUG = False

SECRET_KEY = os.environ['SECRET_KEY']

Django deployment checklist and production settings

django python deployment
by Priya Sharma 1 tab
python
from haystack import indexes
from blog.models import Post


class PostIndex(indexes.SearchIndex, indexes.Indexable):
    text = indexes.CharField(document=True, use_template=True)

Django haystack for advanced search

django python search
by Priya Sharma 2 tabs
python
INSTALLED_APPS += ['drf_spectacular']

REST_FRAMEWORK = {
    'DEFAULT_SCHEMA_CLASS': 'drf_spectacular.openapi.AutoSchema',
}

Django REST Framework schema and documentation

django python rest
by Priya Sharma 3 tabs
python
import random


class ReadWriteRouter:
    """Route reads to replicas, writes to primary."""

Django database read-write split with routers

django python database
by Priya Sharma 3 tabs
python
from django.contrib.auth.models import AbstractUser
from django.db import models


class CustomUser(AbstractUser):
    """Extended user model with additional fields."""

Django custom user model best practices

django python models
by Priya Sharma 2 tabs
python
from django.core.mail import EmailMessage, EmailMultiAlternatives
from django.template.loader import render_to_string
from django.conf import settings
import os

Django email with attachments and templates

django python email
by Priya Sharma 1 tab