scheduling

typescript
type AsyncTask = () => Promise<void>;

export interface GuardOptions {
  name: string;
  logger?: Pick<Console, "info" | "warn" | "error">;
}

Cron scheduling with node-cron (with guard)

reliability node-cron cron
by codesnips 3 tabs
yaml
# === One-off Job: Database migration ===
apiVersion: batch/v1
kind: Job
metadata:
  name: db-migrate
  namespace: production

Kubernetes Jobs and CronJobs for batch workloads

kubernetes cronjob batch
by Ryan Nakamura 1 tab
java
@Component
public class SalesRollupScheduler {

    private static final Logger log = LoggerFactory.getLogger(SalesRollupScheduler.class);
    private static final int ROLLUP_WINDOW_DAYS = 3;

Roll Up Daily Sales Totals With a Scheduled Spring Batch Upsert via JdbcTemplate

spring-boot jdbctemplate postgres
by codesnips 3 tabs
java
package com.example.demo.scheduled;

import com.example.demo.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;

Scheduled tasks with @Scheduled

java spring-boot scheduling
by David Kumar 2 tabs
java
package com.example.fx.config;

import com.github.benmanes.caffeine.cache.Caffeine;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.caffeine.CaffeineCacheManager;

Caching Currency-Conversion Rates in Spring Boot With @Cacheable and Scheduled Eviction

spring-boot caching caffeine
by codesnips 3 tabs
java
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.time.Instant;

Nightly Cleanup of Expired Refresh Tokens with Spring @Scheduled and a Bulk Delete Query

spring-boot scheduling cron
by codesnips 4 tabs
typescript
import { Module } from '@nestjs/common';
import { BullModule } from '@nestjs/bull';
import { ScheduleModule } from '@nestjs/schedule';
import { DigestProducer } from './digest.producer';
import { DigestProcessor } from './digest.processor';

Scheduling and Processing Email Digests with a Bull Queue in NestJS

nestjs bull redis
by codesnips 3 tabs
php
<?php

namespace App\Console\Commands;

use App\Mail\DailySalesReport;
use App\Models\Order;

Nightly Sales Summary Report as a Scheduled Laravel Command with Mailable

laravel scheduling cron
by codesnips 4 tabs
rust
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Interval {
    pub start: i64,
    pub end: i64,
}

Merging Overlapping Booking Intervals with a Sweep-Line in Rust

rust algorithms intervals
by codesnips 3 tabs
yaml
cleanup_expired_sessions:
  cron: '0 2 * * *'  # Daily at 2 AM
  class: CleanupExpiredSessionsWorker
  queue: low
  description: Remove expired sessions from Redis

Background job scheduling with sidekiq-scheduler

rails sidekiq background-jobs
by Alex Kumar 2 tabs
python
from celery import Celery
from celery.schedules import crontab

app = Celery('myproject')
app.config_from_object('django.conf:settings', namespace='CELERY')

Django background tasks with Celery beat for scheduling

django python celery
by Priya Sharma 2 tabs
java
@Configuration
@EnableAsync
public class AsyncConfig {

    @Bean(name = "orderExecutor")
    public ThreadPoolTaskExecutor orderExecutor() {

Debouncing Order Recalculations with Spring @Async and a Configured ThreadPoolTaskExecutor

spring-boot async thread-pool
by codesnips 3 tabs