File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ class OpenSPPAreaImport(models.Model):
2323 _users_model = "res.users"
2424
2525 MIN_ROW_JOB_QUEUE = 400
26+ JOB_QUEUE_BATCH_SIZE = 10
2627
2728 NEW = "New"
2829 UPLOADED = "Uploaded"
@@ -293,7 +294,7 @@ def import_data(self):
293294 column_indexes = self .get_column_indexes (columns , area_level , workbook_type )
294295 self .check_all_languages_activated (columns , area_level )
295296 nrows = self .get_nrows_openpyxl (sheet )
296- batches = math .ceil (nrows / 1000 )
297+ batches = math .ceil (nrows / self . JOB_QUEUE_BATCH_SIZE )
297298 for i in range (batches ):
298299 start = 2 if i == 0 else i * 1000
299300 end = min ((i + 1 ) * 1000 , nrows )
@@ -340,7 +341,7 @@ def validate_raw_data(self):
340341 for rec in self :
341342 rec .locked = True
342343 rec .locked_reason = _ ("Validating data." )
343- ceiling = 10
344+ ceiling = self . JOB_QUEUE_BATCH_SIZE
344345 batches = math .ceil (len (rec .raw_data_ids ) / ceiling )
345346 jobs = []
346347 for i in range (batches ):
You can’t perform that action at this time.
0 commit comments