package httpstream
import (
"bufio"
"database/sql"
"fmt"
CREATE TABLE idempotency_keys (
id BIGSERIAL PRIMARY KEY,
idempotency_key TEXT NOT NULL,
request_path TEXT NOT NULL,
request_fingerprint TEXT NOT NULL,
status TEXT NOT NULL DEFAULT 'in_progress',
import base64
import json
from datetime import datetime
from typing import Optional, Tuple
import uuid
from django.db import models
class Cart(models.Model):
OPEN = "open"
CREATE TABLE daily_metrics (
id BIGGENERATED ALWAYS AS IDENTITY PRIMARY KEY,
tenant_id BIGINT NOT NULL,
metric TEXT NOT NULL,
day DATE NOT NULL,
count BIGINT NOT NULL DEFAULT 0,
module StatementTimeout
extend ActiveSupport::Concern
class TimeoutExceeded < StandardError; end
def with_statement_timeout(milliseconds)
from sqlalchemy import select
from .models import Order, db
def stream_orders(batch_size=1000):
package com.example.feed;
import java.nio.charset.StandardCharsets;
import java.time.Instant;
import java.util.Base64;
class CounterFlushJob
include Sidekiq::Job
sidekiq_options queue: :counters, retry: 3
def perform
CounterBuffer.flush_all.each do |field, delta|
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
export async function getFeedNaive(limit = 20) {
const posts = await prisma.post.findMany({
production:
primary:
adapter: postgresql
database: app_production
username: app
password: <%= ENV["PRIMARY_DB_PASSWORD"] %>
package com.example.feed;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Slice;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;