On Sep 9, 2006, at 6:19 AM, cyberco wrote:

> Forgive me if this is a stupid question, I'm a complete newbie when it
> comes to databases, but how can I make the database generate events?
> The problem is that one of my models has a DateTimeField that is  
> set to
> some point in the future. Somehow I want to be notified when that time
> passes. I can do a periodic poll, but that seems like a lot of  
> overhead
> to me (I'm used to event driven programming models).

I think you have to decide between the overhead of having an object  
in memory just waiting to trigger an event or  the (rather minimal)  
overhead of querying the database for DateTimes in a certain range.  
Especially if you create an index on that field, finding all event  
that are scheduled for the next (or previous) hour, day, or whatever  
level of  quantization you want is going to be pretty minimal.  
Presumably, you're not going to send a web page to someone when the  
event occurs, so just do a check for events they need to be aware of  
when they look at the page you present them on.

Todd

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to