Skip to content

tasks: delay startup signals - #17769

Merged
rissson merged 2 commits into
mainfrom
dramatiq-delay-worker-start
Oct 28, 2025
Merged

rissson merged 2 commits into
mainfrom
dramatiq-delay-worker-start

Conversation

@rissson

@rissson rissson commented Oct 28, 2025

Copy link
Copy Markdown
Member

There somehow is a race condition when starting up the worker, that makes some tasks inexistent even though they actually have been inserted. Here we simply delay the start of the consumers so we can completely finish the startup and only then grab tasks and process them.

Closes #17749

@rissson rissson self-assigned this Oct 28, 2025
@rissson
rissson requested a review from a team as a code owner October 28, 2025 15:24
@rissson rissson added this to the Release 2025.10.1 milestone Oct 28, 2025

@BeryJu BeryJu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont like this solution....but I dont have a better idea either

@github-project-automation github-project-automation Bot moved this from Todo to In Progress in authentik Core Oct 28, 2025
@netlify

netlify Bot commented Oct 28, 2025 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-docs canceled.

Name Link
🔨 Latest commit e08a84b
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/6900fc8e2f19050008cf8402

@netlify

netlify Bot commented Oct 28, 2025 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-storybook canceled.

Name Link
🔨 Latest commit e08a84b
🔍 Latest deploy log https://app.netlify.com/projects/authentik-storybook/deploys/6900fc8d112c94000847f38b

@netlify

netlify Bot commented Oct 28, 2025 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-integrations canceled.

Name Link
🔨 Latest commit e08a84b
🔍 Latest deploy log https://app.netlify.com/projects/authentik-integrations/deploys/6900fc8eebaf420008e46f68

@rissson

rissson commented Oct 28, 2025

Copy link
Copy Markdown
Member Author

I dont like this solution....but I dont have a better idea either

maybe a ctxvar that gets set to true after one of the startup signals have been sent?

@codecov

codecov Bot commented Oct 28, 2025 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 42.85714% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.98%. Comparing base (9b6aa56) to head (e08a84b).
⚠️ Report is 82 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
authentik/tasks/middleware.py 42.85% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17769      +/-   ##
==========================================
+ Coverage   92.88%   92.98%   +0.10%     
==========================================
  Files         869      869              
  Lines       47950    47952       +2     
==========================================
+ Hits        44538    44589      +51     
+ Misses       3412     3363      -49     
Flag Coverage Δ
e2e 45.27% <42.85%> (+0.44%) ⬆️
integration 23.19% <42.85%> (+<0.01%) ⬆️
unit 91.07% <42.85%> (+0.01%) ⬆️
unit-migrate 91.12% <42.85%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cheggerdev

Copy link
Copy Markdown

I dont like this solution....but I dont have a better idea either

maybe a ctxvar that gets set to true after one of the startup signals have been sent?

This is called a semaphore. 😄

@rissson

rissson commented Oct 28, 2025

Copy link
Copy Markdown
Member Author

looking at the tests, yeah, this is not working

@rissson rissson changed the title packages/django-dramatiq-postgres: broker: delay consumer start tasks: delay startup signals Oct 28, 2025
@rissson

rissson commented Oct 28, 2025

Copy link
Copy Markdown
Member Author

that's better

@rissson
rissson requested a review from BeryJu October 28, 2025 17:26
@rissson
rissson enabled auto-merge (squash) October 28, 2025 17:37
@rissson
rissson merged commit 56d399a into main Oct 28, 2025
@rissson
rissson deleted the dramatiq-delay-worker-start branch October 28, 2025 17:56
@github-project-automation github-project-automation Bot moved this from In Progress to Done in authentik Core Oct 28, 2025
authentik-automation Bot pushed a commit that referenced this pull request Oct 28, 2025
@authentik-automation

Copy link
Copy Markdown
Contributor

🍒 Cherry-pick to version-2025.10 created: #17775

@github-actions

Copy link
Copy Markdown
Contributor

authentik PR Installation instructions

Instructions for docker-compose

Add the following block to your .env file:

AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-e08a84bc73e8a03fa62fe300a959fc8f3d556884
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s

Afterwards, run the upgrade commands from the latest release notes.

Instructions for Kubernetes

Add the following block to your values.yml file:

authentik:
    outposts:
        container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
global:
    image:
        repository: ghcr.io/goauthentik/dev-server
        tag: gh-e08a84bc73e8a03fa62fe300a959fc8f3d556884

Afterwards, run the upgrade commands from the latest release notes.

rissson added a commit that referenced this pull request Oct 28, 2025
…17775)

tasks: delay startup signals (#17769)

Co-authored-by: Marc 'risson' Schmitt <[email protected]>
authentik-automation Bot pushed a commit that referenced this pull request Nov 6, 2025
This cherry-pick has conflicts that need manual resolution.

Original PR: #17769
Original commit: 56d399a
@authentik-automation

Copy link
Copy Markdown
Contributor

⚠️ Cherry-pick to version-2025.8 has conflicts: #18008

kensternberg-authentik added a commit that referenced this pull request Nov 10, 2025
* main: (28 commits)
  ci: use hashes for actions everywhere (#17803)
  website/integrations: fixed paperless-ngx yml syntax issue and added additional info (#17739)
  core, web: update translations (#17782)
  ci: rework internal repo (#17797)
  root: use hashes for dockerfile FROM (#17795)
  web: bump validator from 13.15.15 to 13.15.20 in /packages/prettier-config (#17776)
  tasks: delay startup signals (#17769)
  website: bump the build group in /website with 6 updates (#17712)
  core, web: update translations (#17660)
  web: bump vite from 7.1.11 to 7.1.12 in /web (#17689)
  website: bump validator from 13.15.15 to 13.15.20 in /website (#17741)
  web: bump eslint-plugin-react-hooks from 7.0.0 to 7.0.1 in /packages/eslint-config in the eslint group across 1 directory (#17714)
  web: bump validator from 13.15.15 to 13.15.20 in /packages/eslint-config (#17742)
  packages/django-postgres-cache: use upsert instead of select/update in a transaction (#17760)
  providers/radius: fix panic when no cert is configured (#17762)
  sources/oauth: Make PKCE verifier 128 characters (#17763)
  providers/proxy: fix missing JWT/claims header (#17759)
  providers/proxy: add gorm logging (#17758)
  web: bump the sentry group across 1 directory with 2 updates (#17743)
  root: Add Dockerfile label org.opencontainers.image.source (#17756)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2025.10.0: Postgres foreign key violation, unique constraint violation, and ExclusiveLock errors

3 participants