register all cron jobs in entrypoint (#12791)

closes https://github.com/twentyhq/core-team-issues/issues/1113

Three things I am not sure about - 
- Should we have a variable just like DISABLE_DB_MIGRATIONS to control
cron job registration behavior, i.e., DISABLE_CRON_JOBS_REGISTRATION?
- The location of the command ie, folder placement
- https://github.com/twentyhq/twenty/pull/12791/files#r2161734131
This commit is contained in:
nitin
2025-06-24 00:35:01 +05:30
committed by GitHub
parent 00eb93463c
commit 6aee42ab22
8 changed files with 142 additions and 4 deletions

View File

@ -28,7 +28,23 @@ setup_and_migrate_db() {
yarn command:prod upgrade
echo "Successfully migrated DB!"
}
register_background_jobs() {
if [ "${DISABLE_CRON_JOBS_REGISTRATION}" = "true" ]; then
echo "Cron job registration is disabled, skipping..."
return
fi
echo "Registering background sync jobs..."
if yarn command:prod cron:register:all; then
echo "Successfully registered all background sync jobs!"
else
echo "Warning: Failed to register background jobs, but continuing startup..."
fi
}
setup_and_migrate_db
register_background_jobs
# Continue with the original Docker command
exec "$@"