Skip to content

Commit

Permalink
Default to chunksize of 1 when loading Applications, LinkedApplicatio…
Browse files Browse the repository at this point in the history
…ns and RemoteApps
  • Loading branch information
minhaminha committed Dec 11, 2023
1 parent 7d93c9a commit 2375ff5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion corehq/apps/dump_reload/couch/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from couchdbkit.exceptions import ResourceNotFound

from corehq.apps.app_manager.models import Application, LinkedApplication, RemoteApp
from corehq.apps.dump_reload.exceptions import DataExistsException
from corehq.apps.dump_reload.interface import DataLoader
from corehq.util.couch import (
Expand Down Expand Up @@ -53,7 +54,10 @@ def _get_db_for_doc_type(self, doc_type):
if couch_db is None:
raise DocumentClassNotFound('No Document class with name "{}" could be found.'.format(doc_type))
callback = LoaderCallback(self._success_counter, self.stdout)
db = IterDB(couch_db, new_edits=False, callback=callback)
chunksize = 100
if doc_type in [Application._doc_type, LinkedApplication._doc_type, RemoteApp._doc_type]:
chunksize = 1
db = IterDB(couch_db, new_edits=False, callback=callback, chunksize=chunksize)
db.__enter__()
self._dbs[doc_type] = db
return self._dbs[doc_type]
Expand Down

0 comments on commit 2375ff5

Please sign in to comment.