[PR #1160] [MERGED] feat: background tasks #1435

Closed
opened 2026-02-26 19:33:14 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/documenso/documenso/pull/1160
Author: @Mythie
Created: 5/15/2024
Status: Merged
Merged: 6/21/2024
Merged by: @Mythie

Base: mainHead: feat/background-tasks


📝 Commits (10+)

  • 108054a wip: background tasks
  • 61827ad fix: make trigger.dev work properly
  • 991f808 feat: ghetto durable compute
  • 2e41ecf fix: remove dummy code from email job
  • 002dc0f fix: make local provider robust to random input
  • f28334b feat: make jobs client type safe
  • 1c5da46 fix: update signing email job
  • 6977381 feat: inngest provider
  • b8d6484 fix: improve inngest support
  • 8bb936a chore: add env vars to example .env

📊 Changes

33 files changed (+13593 additions, -7949 deletions)

View changed files

📝 .env.example (+6 -0)
📝 .vscode/settings.json (+11 -3)
📝 apps/marketing/package.json (+1 -1)
📝 apps/web/package.json (+1 -1)
apps/web/src/pages/api/jobs/[[...handler]].ts (+10 -0)
📝 docker/development/compose.yml (+45 -0)
📝 package-lock.json (+12452 -7829)
📝 package.json (+12 -3)
📝 packages/ee/package.json (+1 -1)
packages/lib/jobs/client.ts (+12 -0)
packages/lib/jobs/client/_internal/job.ts (+61 -0)
packages/lib/jobs/client/_internal/json.ts (+14 -0)
packages/lib/jobs/client/base.ts (+19 -0)
packages/lib/jobs/client/client.ts (+30 -0)
packages/lib/jobs/client/inngest.ts (+120 -0)
packages/lib/jobs/client/local.ts (+351 -0)
packages/lib/jobs/client/trigger.ts (+73 -0)
packages/lib/jobs/definitions/send-confirmation-email.ts (+30 -0)
packages/lib/jobs/definitions/send-signing-email.ts (+171 -0)
📝 packages/lib/next-auth/auth-options.ts (+7 -2)

...and 13 more files

📄 Description

Description

Currently a work in progress but this adds background tasks to Documenso for handling tasks that take a little longer and aren't part of the overall critical path.

N/A

Changes Made

Added a pluggable jobs provider supporting both a local provider and a Trigger.dev provider.

Testing Performed

  • Verified job level retries work
  • Verified task level retries work without incrementing job retries

image
image

This will still have a lot of rough edges but is a perfect MVP for local durable compute which may accept more providers later on

Summary by CodeRabbit

  • New Features

    • Added background job management functionalities to handle email sending and job processing.
    • Introduced support for triggering and managing jobs using various providers.
  • Chores

    • Updated environment configuration files to support new job management features.
    • Added and updated scripts and dependencies for job management and CLI commands.
  • Refactor

    • Refactored email sending functionalities to utilize the new job queue mechanism.
  • Documentation

    • Updated documentation to reflect the new environment variables and configurations related to background jobs.
  • Configuration

    • Updated Docker configurations to support new services for job management.
    • Updated VSCode settings for improved development experience with new dependencies and formatting rules.
  • Database

    • Added new database schemas and migrations to support background job management and tracking.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/documenso/documenso/pull/1160 **Author:** [@Mythie](https://github.com/Mythie) **Created:** 5/15/2024 **Status:** ✅ Merged **Merged:** 6/21/2024 **Merged by:** [@Mythie](https://github.com/Mythie) **Base:** `main` ← **Head:** `feat/background-tasks` --- ### 📝 Commits (10+) - [`108054a`](https://github.com/documenso/documenso/commit/108054a133c779a454eb14d362b23969606bc737) wip: background tasks - [`61827ad`](https://github.com/documenso/documenso/commit/61827ad7290def1013d42ad8217b009acaa460fa) fix: make trigger.dev work properly - [`991f808`](https://github.com/documenso/documenso/commit/991f808890739eafad1cd55a1f5d2e0addcef7f9) feat: ghetto durable compute - [`2e41ecf`](https://github.com/documenso/documenso/commit/2e41ecf8250520a4348dcd0532acb9c86047d5b4) fix: remove dummy code from email job - [`002dc0f`](https://github.com/documenso/documenso/commit/002dc0fdae9142966cd2a145eed764c649ecb16d) fix: make local provider robust to random input - [`f28334b`](https://github.com/documenso/documenso/commit/f28334bff7836e1a6309defb1b724e40299a6446) feat: make jobs client type safe - [`1c5da46`](https://github.com/documenso/documenso/commit/1c5da463356e93fb6b182ae61ee40b5c94f9bf23) fix: update signing email job - [`6977381`](https://github.com/documenso/documenso/commit/6977381e001768b3920ee55c743488e4065ddbae) feat: inngest provider - [`b8d6484`](https://github.com/documenso/documenso/commit/b8d6484ff07d94f20b55223f4785148bdaf24021) fix: improve inngest support - [`8bb936a`](https://github.com/documenso/documenso/commit/8bb936aa51ade12cf63c00d2b5cacb7e23dca8e6) chore: add env vars to example .env ### 📊 Changes **33 files changed** (+13593 additions, -7949 deletions) <details> <summary>View changed files</summary> 📝 `.env.example` (+6 -0) 📝 `.vscode/settings.json` (+11 -3) 📝 `apps/marketing/package.json` (+1 -1) 📝 `apps/web/package.json` (+1 -1) ➕ `apps/web/src/pages/api/jobs/[[...handler]].ts` (+10 -0) 📝 `docker/development/compose.yml` (+45 -0) 📝 `package-lock.json` (+12452 -7829) 📝 `package.json` (+12 -3) 📝 `packages/ee/package.json` (+1 -1) ➕ `packages/lib/jobs/client.ts` (+12 -0) ➕ `packages/lib/jobs/client/_internal/job.ts` (+61 -0) ➕ `packages/lib/jobs/client/_internal/json.ts` (+14 -0) ➕ `packages/lib/jobs/client/base.ts` (+19 -0) ➕ `packages/lib/jobs/client/client.ts` (+30 -0) ➕ `packages/lib/jobs/client/inngest.ts` (+120 -0) ➕ `packages/lib/jobs/client/local.ts` (+351 -0) ➕ `packages/lib/jobs/client/trigger.ts` (+73 -0) ➕ `packages/lib/jobs/definitions/send-confirmation-email.ts` (+30 -0) ➕ `packages/lib/jobs/definitions/send-signing-email.ts` (+171 -0) 📝 `packages/lib/next-auth/auth-options.ts` (+7 -2) _...and 13 more files_ </details> ### 📄 Description ## Description Currently a work in progress but this adds background tasks to Documenso for handling tasks that take a little longer and aren't part of the overall critical path. ## Related Issue N/A ## Changes Made Added a pluggable jobs provider supporting both a local provider and a Trigger.dev provider. ## Testing Performed - Verified job level retries work - Verified task level retries work without incrementing job retries ![image](https://github.com/documenso/documenso/assets/13398220/3bbfbc7f-28ef-43ab-a539-ae0d4e900b43) ![image](https://github.com/documenso/documenso/assets/13398220/fd012169-4986-4653-b852-ba6e19a5d131) **This will still have a lot of rough edges but is a perfect MVP for local _durable_ compute which may accept more providers later on** <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added background job management functionalities to handle email sending and job processing. - Introduced support for triggering and managing jobs using various providers. - **Chores** - Updated environment configuration files to support new job management features. - Added and updated scripts and dependencies for job management and CLI commands. - **Refactor** - Refactored email sending functionalities to utilize the new job queue mechanism. - **Documentation** - Updated documentation to reflect the new environment variables and configurations related to background jobs. - **Configuration** - Updated Docker configurations to support new services for job management. - Updated VSCode settings for improved development experience with new dependencies and formatting rules. - **Database** - Added new database schemas and migrations to support background job management and tracking. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 19:33:14 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/documenso#1435
No description provided.