From 7c490b46c8c5cb298c75f249724c9c8b179da58a Mon Sep 17 00:00:00 2001 From: Jake Moshenko Date: Mon, 5 Dec 2016 18:05:18 -0500 Subject: [PATCH] Only save dirty fields on Queue queries. --- data/database.py | 5 +++++ data/queue.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/data/database.py b/data/database.py index afc1573b4..c5c7af0d8 100644 --- a/data/database.py +++ b/data/database.py @@ -758,6 +758,11 @@ class QueueItem(BaseModel): processing_expires = DateTimeField(null=True, index=True) retries_remaining = IntegerField(default=5, index=True) + class Meta: + database = db + read_slaves = (read_slave,) + only_save_dirty = True + class RepositoryBuild(BaseModel): uuid = CharField(default=uuid_generator, index=True) diff --git a/data/queue.py b/data/queue.py index 421d7d6e7..0f9865d29 100644 --- a/data/queue.py +++ b/data/queue.py @@ -270,7 +270,7 @@ class WorkQueue(object): queue_item.processing_expires = new_expiration 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 has_change = True