codesnips
Browse Tags Share a snippet
Sign in
Join us today
Share your craft projects Make new craft buddies Ask craft questions Blog your craft journey
All Latest Trending
java
import jakarta.persistence.*;
import java.math.BigDecimal;
import java.util.Objects;

@Entity
@Table(name = "accounts")

Optimistic Locking with JPA @Version and Retry on Concurrent Updates

jpa hibernate spring
by codesnips 3 tabs
ruby
module EventBus
  @subscribers = Hash.new { |h, k| h[k] = [] }

  class << self
    def subscribe(event_class, handler = nil, &block)
      callable = handler || block

In-Process Domain Event Bus with Subscribers in Rails

rails domain-events event-bus
by codesnips 4 tabs
go
package hub

type Hub struct {
	subscribers map[*Subscriber]struct{}
	broadcast   chan []byte
	register    chan registration

Concurrent Fan-Out Event Hub With Non-Blocking Broadcast in Go

go concurrency channels
by codesnips 3 tabs
ruby
class Article < ApplicationRecord
  include PgSearch::Model

  pg_search_scope :full_text_search,
    against: { title: 'A', body: 'B' },
    using: {

Full-Text Search Endpoint in Rails with pg_search Scope and a Search Form Object

rails postgres full-text-search
by codesnips 4 tabs
javascript
const RETRYABLE_STATUS = new Set([408, 429, 500, 502, 503, 504]);

export function fullJitter(attempt, baseDelay = 300, maxDelay = 10_000) {
  const ceiling = Math.min(maxDelay, baseDelay * 2 ** attempt);
  return Math.random() * ceiling;
}

Fetch With Exponential Backoff and Full Jitter Retries

fetch retry exponential-backoff
by codesnips 3 tabs
Previous
1 ... 34 35 36
Next
CodeSnips

CodeSnips is crafted with passion and great attention to detail.

Privacy Terms
Facebook Instagram Pinterest
Tags

© 2024 CodeSnips. All Rights Reserved. Running on Ruby on Rails.

Disclaimer: Any posts on CodeSnips.io are posted by individuals acting in their own right and do not necessarily reflect the views of CodeSnips.
CodeSnips will not be held liable for the actions of any user.