Skip to content

Commit

Permalink
Merge pull request #109 from collective/queue_processor_active
Browse files Browse the repository at this point in the history
Check addon is installed before processing queue
  • Loading branch information
ericof authored Mar 8, 2023
2 parents 6bb664b + 212ec15 commit 686e6a7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@

- Handle negative term filters (fixes #101) @instification

- Check addon is installed before processing queue (fixes #108) @instification

- Add support for optional es host in worker via PLONE_ELASTICSEARCH_HOST env variable @maethu


## 5.0.0 (2022-10-11)

- Rename `master` branch to `main` @ericof
Expand Down
6 changes: 6 additions & 0 deletions src/collective/elasticsearch/queueprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ def _uuid_path(self, obj):

def index(self, obj, attributes=None):
"""Index the specified attributes for an obj."""
if not self.manager.active:
return
actions = self.actions
uuid, path = self._uuid_path(obj)
actions.uuid_path[uuid] = path
Expand Down Expand Up @@ -156,10 +158,14 @@ def index(self, obj, attributes=None):

def reindex(self, obj, attributes=None, update_metadata=False):
"""Reindex the specified attributes for an obj."""
if not self.manager.active:
return
self.index(obj, attributes)

def unindex(self, obj):
"""Unindex the obj."""
if not self.manager.active:
return
actions = self.actions
uuid, path = self._uuid_path(obj)
actions.uuid_path[uuid] = path
Expand Down

0 comments on commit 686e6a7

Please sign in to comment.