class ExportWriter
def initialize(export)
@export = export
end
def append(rows)
@Entity
@Table(name = "idempotency_records",
uniqueConstraints = @UniqueConstraint(columnNames = "idempotency_key"))
public class IdempotencyRecord {
public enum Status { IN_PROGRESS, COMPLETED }
module QueryBudget
class Counter
IGNORED = %w[SCHEMA CACHE TRANSACTION].freeze
attr_reader :count
<?php
namespace App\Jobs;
use App\Models\Invoice;
use App\Services\StripeGateway;
package webhook
import (
"encoding/json"
"io"
"net/http"
const withTimeout = (promise, timeoutMs, name) => {
let timer;
const timeout = new Promise((_, reject) => {
timer = setTimeout(
() => reject(new Error(`check '${name}' timed out after ${timeoutMs}ms`)),
timeoutMs
class SlidingWindowLimiter
Result = Struct.new(:allowed, :count, :limit, :window_ms, keyword_init: true)
SCRIPT = <<~LUA.freeze
local key = KEYS[1]
local now = tonumber(ARGV[1])
@Configuration
public class TxConfig {
@Bean
public PlatformTransactionManager transactionManager(DataSource dataSource) {
DataSourceTransactionManager tm = new DataSourceTransactionManager(dataSource);
class ApiError extends Error {
constructor(statusCode, message, code) {
super(message);
this.name = 'ApiError';
this.statusCode = statusCode;
this.code = code || null;
package mailer
import (
"crypto/sha256"
"encoding/hex"
"strings"
package cleanup
import "errors"
func CloseAll(closers ...func() error) error {
var errs []error
package limit
import (
"context"
"golang.org/x/sync/semaphore"