Skip to content

Commit

Permalink
kopano-search: Fix regression introduced with commit 5d7e051 causing …
Browse files Browse the repository at this point in the history
…high cpu-load in kopano-server and mysqld.

Signed-off-by: Armin Schöffmann <armin.schoeffmann@aegaeon.de>
  • Loading branch information
umgfoin committed Sep 8, 2021
1 parent 268d15f commit 18db9fd
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions ECtools/search/kopano_search/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,24 +199,22 @@ def main(self):
folder = kopano.Folder(store, folderid)
path = folder.path

if not self.indexed_folder(config, store, folder):
continue

suggestions = config['suggestions'] and folder != store.junk
self.log.info('syncing folder: "%s" "%s"', store.name, path)
importer = FolderImporter(server.guid, config, plugin, suggestions, self.log)
state = db_get(state_db, folder.entryid) if not reindex else None

if state:
self.log.info('found previous folder sync state: %s', state)
t0 = time.time()
new_state = folder.sync(importer, state, log=self.log)
if new_state != state:
plugin.commit(suggestions)
db_put(state_db, folder.entryid, new_state)
self.log.info('saved folder sync state: %s', new_state)
changes = importer.changes + importer.deletes
self.log.info('syncing folder "%s" took %.2f seconds (%d changes, %d attachments)', path, time.time()-t0, changes, importer.attachments)
if self.indexed_folder(config, store, folder):
suggestions = config['suggestions'] and folder != store.junk
self.log.info('syncing folder: "%s" "%s"', store.name, path)
importer = FolderImporter(server.guid, config, plugin, suggestions, self.log)
state = db_get(state_db, folder.entryid) if not reindex else None

if state:
self.log.info('found previous folder sync state: %s', state)
t0 = time.time()
new_state = folder.sync(importer, state, log=self.log)
if new_state != state:
plugin.commit(suggestions)
db_put(state_db, folder.entryid, new_state)
self.log.info('saved folder sync state: %s', new_state)
changes = importer.changes + importer.deletes
self.log.info('syncing folder "%s" took %.2f seconds (%d changes, %d attachments)', path, time.time()-t0, changes, importer.attachments)
except MAPIErrorNetworkError:
self.log.warn('unable to connect to kopano-server, retrying... (%s times)', retries)
retries += 1
Expand Down

0 comments on commit 18db9fd

Please sign in to comment.