Commits

Anonymous committed db3640b

Change datetime stamps to use UTC time

Comments (0)

Files changed (3)

 
 In version 0.1.4, we are introducing two major changes:
 
-1. Tasks now have a "created" datetime field. This was added to make sure `--replayfailed` replayed tasks in the appropriate order
+1. Tasks now have a `created` datetime field. This was added to make sure `--replayfailed` replayed tasks in the appropriate order
 2. Introduced [South](http://south.aeracode.org/) migrations.
 
-IF YOU HAVE ALREADY INSTALLED django-ztask - you can "fake" the first migration, and then run the second migration:
+IF YOU HAVE ALREADY INSTALLED `django-ztask` - you can "fake" the first migration, and then run the second migration:
 
     ./manage.py migrate django_ztask --fake 0001
     ./manage.py migrate django_ztask
 
 Download and install 0MQ version 2.1.3 or better from [http://www.zeromq.org](http://www.zeromq.org)
 
-Install pyzmq and django_ztaskd using PIP:
+Install pyzmq and django-ztask using PIP:
 
     pip install pyzmq
     pip install -e git+git@github.com:dmgctrl/django-ztask.git#egg=django_ztask

django_ztask/management/commands/ztaskd.py

                     task.retry_count = task.retry_count - 1
                     task.next_attempt = time.time() + settings.ZTASKD_RETRY_AFTER
                     ioloop.DelayedCallback(lambda: self._call_function(task.pk), settings.ZTASKD_RETRY_AFTER * 1000, io_loop=self.io_loop).start()
-                task.failed = datetime.datetime.now()
+                task.failed = datetime.datetime.utcnow()
                 task.last_exception = '%s' % e
                 task.save()
             except Exception, e2:

django_ztask/models.py

     
     def save(self, *args, **kwargs):
         if not self.uuid:
-            self.created = datetime.datetime.now()
+            self.created = datetime.datetime.utcnow()
             self.uuid = uuid.uuid4()
         super(Task, self).save(*args, **kwargs)