use std::time::{Duration, Instant};
pub struct LeakyBucket {
level: f64,
capacity: f64,
rate_per_sec: f64,
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
require 'digest'
require 'json'
module CacheHelpers
def cache_control_public(max_age = 60)
cache_control :public, :must_revalidate, max_age: max_age
from flask import jsonify
from marshmallow import ValidationError as MarshmallowValidationError
from werkzeug.exceptions import HTTPException
class ApiError(Exception):
@Configuration
@EnableAsync
public class AsyncConfig {
@Bean(name = "downstreamExecutor")
public ThreadPoolTaskExecutor downstreamExecutor() {
local key = KEYS[1]
local capacity = tonumber(ARGV[1])
local rate = tonumber(ARGV[2])
local now = tonumber(ARGV[3])
local ttl = tonumber(ARGV[4])
import { z } from "zod";
const flagValueSchema = z.union([
z.boolean(),
z.object({
rollout: z.number().min(0).max(100),
use std::io::{self, Read, Write};
pub const HEADER_LEN: usize = 8; // 4-byte length + 4-byte crc
#[derive(Debug)]
pub enum DecodeError {
<?php
namespace App\Feature;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Contracts\Service\ResetInterface;
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
CREATE TABLE outbox_deliveries (
id BIGSERIAL PRIMARY KEY,
dedupe_key TEXT NOT NULL,
target_url TEXT NOT NULL,
payload JSONB NOT NULL,
status TEXT NOT NULL DEFAULT 'PENDING',
const rolePermissions = {
guest: ['article:read'],
author: ['article:read', 'article:create', 'article:update:own'],
editor: ['article:publish', 'article:update:any'],
admin: ['user:manage', 'role:assign']
};