CREATE TABLE idempotency_keys (
request_key text NOT NULL,
endpoint text NOT NULL,
request_fingerprint text NOT NULL,
status text NOT NULL DEFAULT 'in_progress'
CHECK (status IN ('in_progress', 'completed')),
CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://127.0.0.1:6379/1",
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
module ConnectionHealth
extend ActiveSupport::Concern
def with_fresh_connection
conn = ActiveRecord::Base.connection
conn.verify! # pings and reconnects if the socket is dead
module DefensiveDeserialization
extend ActiveSupport::Concern
MissingRecord = Struct.new(:gid) do
def missing?
true
module BoundedFanOut
Result = Struct.new(:value, :error) do
def ok?
error.nil?
end
end
require "rack/attack"
require "redis-store"
class Rack::Attack
cache.store = Redis::Store.new(url: ENV.fetch("REDIS_URL", "redis://localhost:6379/1"))
package flags
import (
"context"
"encoding/json"
"sync/atomic"
import errno
import fcntl
import os
import time
'use strict';
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
function backoffDelay(attempt, baseMs, maxDelayMs) {
const exponential = baseMs * 2 ** attempt;
package middleware
import (
"net/http"
"golang.org/x/time/rate"
import { Pool } from "pg";
async function keyFor(pool: Pool, name: string): Promise<string> {
const { rows } = await pool.query<{ key: string }>(
"SELECT hashtextextended($1, 0) AS key",
[name]
package health
import (
"context"
"net"
"net/http"