<?php
namespace App\Event;
use Symfony\Contracts\EventDispatcher\Event;
class CommentsChannel < ApplicationCable::Channel
def subscribed
post = find_post
if post
stream_for post
else
@Component
public class SalesRollupScheduler {
private static final Logger log = LoggerFactory.getLogger(SalesRollupScheduler.class);
private static final int ROLLUP_WINDOW_DAYS = 3;
class CreateStripeEvents < ActiveRecord::Migration[7.1]
def change
create_table :stripe_events do |t|
t.string :stripe_event_id, null: false
t.string :event_type, null: false
t.string :status, null: false, default: "received"
require "sidekiq/api"
class QueueDepthGuard
class QueueSaturated < StandardError
attr_reader :queue, :depth
module StatementTimeout
extend ActiveSupport::Concern
class TimeoutExceeded < StandardError; end
def with_statement_timeout(milliseconds)
class RegistrationsController < ApplicationController
def new
@user = User.new
end
def create
package jobs
import (
"context"
"math/rand"
"time"
class Import < ApplicationRecord
include ActionView::RecordIdentifier
enum status: { pending: 0, processing: 1, completed: 2, failed: 3 }
has_one_attached :file
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 {
class UserNotificationJob < ApplicationJob
queue_as :default
# Retry up to 5 times with exponential backoff
retry_on StandardError, wait: :exponentially_longer, attempts: 5