Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8215037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:39:23+00:00 2026-06-07T11:39:23+00:00

I’m building a customer nurturing application which will send an email when some time

  • 0

I’m building a customer nurturing application which will send an email when some time based condition is met on an order such as:

  • 50% OF Order time_to_ship elapsed
  • 10 DAYS AFTER Order ship_date
  • 5 DAYS AFTER NewsletterSubscriber signup_date

I’m trying to determine how to best fire and handle these events. I have no experience dealing with this problem so any input is appreciated.

Current idea: poll for matches for each handler and ensure each handler-match combo fires only once via an extra table. In this case, I wouldn’t be firing events that I could listen to elsewhere, each handler is doing its own query. 3 handlers on 5 days after ... would fire 3 queries.

#  build table that stores which handlers have fired for a given object 
class HandlerFired(models.Model):
    ctype = models.ForeignKey(ContentType, related_name="handlerfired_ctype")
    id = models.IntegerField()
    handler = models.ForeignKey(Handler)

class Handler(models.Model):
    ctype = models.ForeignKey(ContentType)
    condition = ...

#  cron job every day 
for handler in Handler.objects.filter(is_active=True):
    objects = handler.run_query().exclude(
         handlerfired=handler, handlerfired_ctype=handler.ctype)
    handler.handle(objects) # do whatever it's supposed to do with given objects.
    # handle() would also make sure the `HandlerFired` table is populated with a record.

The idea has given me a bit more grief / options than I imagined when I started the project. It does seem like a pretty common problem to have time driven events.

Alternatively, I could do a daily cron job of events not handlers but I think I would have to keep track of every event fired to ensure I don’t fire 2, or that one isn’t skipped (say 20% event skipped because of downtime). This would store thousands more records than recording handlers that have fired but feels more like a true event emitter.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T11:39:25+00:00Added an answer on June 7, 2026 at 11:39 am

    Django async is an async execution queue. You can schedule a future event which will then check to see if the condition is valid at that time. For example, when the order is shipped schedule an event that fires 10 days later and when that executes it can make sure about any other conditions before sending the email.

    http://pypi.python.org/pypi/django-async/

    Django async has built in the run once behaviour and if the queue stops for any reason it will catch up on past jobs when it’s restarted. Transient errors (like the SMTP server being down) will be automatically retried.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.