import { Prisma, PrismaClient } from "@prisma/client";
const prisma = new PrismaClient();
type TxClient = Prisma.TransactionClient;
const express = require('express');
const webhookRouter = require('./webhookRouter');
const apiRouter = require('./apiRouter');
const app = express();
from django.conf import settings
from django.db.models.signals import post_save
from django.dispatch import receiver
from .models import EmailOutbox
class WebhookSignature
class VerificationError < StandardError; end
TOLERANCE = 300 # seconds
def initialize(payload:, header:, secrets:)
CREATE TYPE outbox_status AS ENUM ('pending', 'retry', 'processing', 'done', 'dead');
CREATE TABLE outbox_events (
id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
dedupe_key TEXT NOT NULL,
topic TEXT NOT NULL,
class AddSlugToPosts < ActiveRecord::Migration[7.1]
def change
add_column :posts, :slug, :string, null: false
add_index :posts, :slug, unique: true
end
end
namespace :cleanup do
desc "Enqueue a job to purge expired sessions"
task expired_sessions: :environment do
job = ExpiredSessionCleanupJob.perform_later
Rails.logger.info("[cleanup:expired_sessions] enqueued job #{job.job_id}")
end
require "securerandom"
class RedisMutex
class LockError < StandardError; end
UNLOCK_SCRIPT = <<~LUA.freeze
<?php
namespace App\Jobs;
use App\Models\Invoice;
use App\Services\StripeGateway;
CREATE TABLE events (
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
source text NOT NULL,
external_id text NOT NULL,
payload jsonb NOT NULL,
occurred_at timestamptz NOT NULL,
class DebouncedReindexJob
include Sidekiq::Job
sidekiq_options queue: :indexing, retry: 5
DEBOUNCE_DELAY = 5 # seconds
import hmac
import hashlib
import time
from fastapi import Request, HTTPException, status