Skip to content

Commit ec8cf95

Browse files
committed
feature #102 Adding support for scheduled tasks (Nyholm)
This PR was squashed before being merged into the master branch. Discussion ---------- Adding support for scheduled tasks This is awfully similar to Messenger component. I decided on this approach because I might want to schedule a task for 2-3 weeks. That is too much for Messenger's `DelayStamp` with AMQP. Commits ------- dd6aca7 Adding envar 6a20992 Added config and migrations 3b5ab60 Make sure symfony cloud have a database 29caf57 Adding support for scheduled tasks
2 parents 541ad5e + dd6aca7 commit ec8cf95

17 files changed

+2064
-44
lines changed

.env

+8
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,11 @@ BOT_USERNAME='carsonbot-test'
2525
###> knplabs/github-api ###
2626
#GITHUB_TOKEN=XXX
2727
###< knplabs/github-api ###
28+
29+
###> doctrine/doctrine-bundle ###
30+
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
31+
# For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
32+
# For a PostgreSQL database, use: "postgresql://db_user:[email protected]:5432/db_name?serverVersion=11&charset=utf8"
33+
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
34+
DATABASE_URL=sqlite:///%kernel.project_dir%/var/data.db
35+
###< doctrine/doctrine-bundle ###

.symfony.cloud.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ runtime:
66
extensions:
77
- apcu
88
- mbstring
9+
- pdo_pgsql
910

1011
build:
1112
flavor: none
@@ -31,3 +32,11 @@ hooks:
3132
deploy: |
3233
set -x -e
3334
(>&2 symfony-deploy)
35+
36+
crons:
37+
run_Tasks:
38+
spec: */5 * * * *
39+
cmd: croncape bin/console app:task:run
40+
41+
relationships:
42+
database: "mydatabase:postgresql"

.symfony/services.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
mydatabase:
2+
# supported versions: 9.6, 10, 11, 12
3+
# 9.3 is also available but not maintained upstream
4+
type: postgresql:12
5+
disk: 1024

composer.json

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
"license": "MIT",
55
"require": {
66
"php": ">=7.2",
7+
"composer/package-versions-deprecated": "^1.11",
8+
"doctrine/doctrine-bundle": "^2.1",
9+
"doctrine/doctrine-migrations-bundle": "^3.0",
10+
"doctrine/orm": "^2.7",
711
"incenteev/composer-parameter-handler": "~2.0",
812
"knplabs/github-api": "^2.1",
913
"nyholm/psr7": "^1.3",

0 commit comments

Comments
 (0)