Giter Club home page Giter Club logo

Comments (5)

selwin avatar selwin commented on August 21, 2024

You should cron send_queued_mail management command instead of calling send_queued_mail directly.

python manage.py send_queued_mail

from django-post_office.

ldm616 avatar ldm616 commented on August 21, 2024

Normally I would, but Heroku doesn't support cron jobs.

from django-post_office.

selwin avatar selwin commented on August 21, 2024

This may not be the most up to date of instructions, but you can try something like this: http://guidovanoorschot.nl/adding-cron-jobs-to-a-django-project-with-heroku-scheduler/

Sent from my phone

On Jan 30, 2014, at 10:04 PM, ldm616 [email protected] wrote:

Normally I would, but Heroku doesn't support cron jobs.


Reply to this email directly or view it on GitHub.

from django-post_office.

ldm616 avatar ldm616 commented on August 21, 2024

Thanks. Scheduler works - but the max frequency is once every 5 mins. I
need once every minute.

My pseudo cron job on Heroku using apscheduler works, but it seems to open
a new database connection each time it runs and starts to max out my
connections. I've tried using a database pooler, but that doesn't help.

On Thu, Jan 30, 2014 at 6:22 AM, Selwin Ong [email protected]:

This may not be the most up to date of instructions, but you can try
something like this:
http://guidovanoorschot.nl/adding-cron-jobs-to-a-django-project-with-heroku-scheduler/

Sent from my phone

On Jan 30, 2014, at 10:04 PM, ldm616 [email protected] wrote:

Normally I would, but Heroku doesn't support cron jobs.

Reply to this email directly or view it on GitHub.

Reply to this email directly or view it on GitHubhttps://github.com//issues/45#issuecomment-33691461
.

from django-post_office.

ldm616 avatar ldm616 commented on August 21, 2024

SOLVED.

I read somewhere that Django doesn't close db connections after running management commands. I tweaked my pseudo cron job as follows to explicitly close the db connection after send_queued_mail runs.

...
from django.core.management import call_command
from django import db

@sched.interval_schedule(minutes=1)
def timed_job():
    call_command('send_queued_mail')
    db.close_connection()

...

from django-post_office.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.