Only save dirty fields on Queue queries.

This commit is contained in:
Jake Moshenko 2016-12-05 18:05:18 -05:00
parent 99f69c9631
commit 7c490b46c8
2 changed files with 6 additions and 1 deletions

View file

@ -758,6 +758,11 @@ class QueueItem(BaseModel):
processing_expires = DateTimeField(null=True, index=True) processing_expires = DateTimeField(null=True, index=True)
retries_remaining = IntegerField(default=5, index=True) retries_remaining = IntegerField(default=5, index=True)
class Meta:
database = db
read_slaves = (read_slave,)
only_save_dirty = True
class RepositoryBuild(BaseModel): class RepositoryBuild(BaseModel):
uuid = CharField(default=uuid_generator, index=True) uuid = CharField(default=uuid_generator, index=True)

View file

@ -270,7 +270,7 @@ class WorkQueue(object):
queue_item.processing_expires = new_expiration queue_item.processing_expires = new_expiration
has_change = True has_change = True
if updated_data is not None: if updated_data is not None and queue_item.body != updated_data:
queue_item.body = updated_data queue_item.body = updated_data
has_change = True has_change = True