Code Explainers

Code explainers tagged #select

go
package streaming
 
import (
	"bufio"

Streaming NDJSON logs over HTTP in Go

http-streaming channels select
Advanced 10 steps
go
func (w *Watcher) resetDebounce(d time.Duration) {
	if !w.timer.Stop() {
		select {
		case <-w.timer.C:

Debouncing a stream of events in Go

debounce timers channels
Advanced 7 steps
go
func StreamLogs(c *gin.Context) {
	path := c.Query("file")
	if path == "" {
		c.JSON(http.StatusBadRequest, gin.H{"error": "missing file parameter"})

Streaming a live log tail with SSE in Gin

server-sent-events streaming channels
Advanced 10 steps
rust
use crossbeam_channel::{Receiver, Sender, select, tick};
use std::time::Duration;
 
pub enum Command {

A channel-driven worker loop in Rust

channels select message-passing
Intermediate 9 steps
rust
use std::collections::HashSet;
use std::path::PathBuf;
use std::time::Duration;
 

Debouncing filesystem events in async Rust

debounce async channels
Advanced 7 steps
go
package pipeline
 
import "sync"
 

The fan-in pattern in Go channels

concurrency channels fan-in
Advanced 8 steps
rust
use std::time::Duration;
 
use axum::{routing::get, Router};
use tokio::net::TcpListener;

Graceful shutdown in an Axum server

graceful-shutdown signal-handling async
Intermediate 8 steps