import uuid
from django.db import models
class Cart(models.Model):
OPEN = "open"
class TokenBucket {
constructor(capacity, refillPerSecond) {
this.capacity = capacity;
this.refillPerMs = refillPerSecond / 1000;
this.tokens = capacity;
this.lastRefill = Date.now();
package worker
import (
"context"
"errors"
"log"
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,
import asyncio
import time
from dataclasses import dataclass
from typing import Any, Dict
use std::sync::Arc;
use std::time::{Duration, Instant};
use tokio::sync::Mutex;
use tokio::time::sleep;
#[derive(Debug)]
<?php
namespace App\Http\Controllers;
use App\Models\Wallet;
use App\Services\WalletService;
package pipeline
import "context"
func generate(ctx context.Context, nums ...int) <-chan int {
out := make(chan int)
class CounterFlushJob
include Sidekiq::Job
sidekiq_options queue: :counters, retry: 3
def perform
CounterBuffer.flush_all.each do |field, delta|
import { Queue } from "bullmq";
import { createHash } from "crypto";
export const connection = { host: "127.0.0.1", port: 6379 };
export interface ChargePayload {
import time
import uuid
from dataclasses import dataclass
import redis
use async_trait::async_trait;
use serde::Serialize;
#[derive(Clone, Copy, PartialEq, Eq, Serialize)]
#[serde(rename_all = "lowercase")]
pub enum Status {