Skip to content

Commit 3843454

Browse files
authored
Merge pull request #49 from cloudblue/LITE-30582-upload-issue-with-big-files
LITE-30582 Fix add with next verbose all error
2 parents d9756d5 + e9763a3 commit 3843454

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

connect_bi_reporter/uploads/services.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,19 @@ def create_uploads(db, client, logger, feeds):
145145
feed_id=feed.id,
146146
report_id=report_file['id'],
147147
))
148+
created_uploads = []
148149
if uploads:
149-
db.add_all_with_next_verbose(uploads, related_id_field=Upload.feed_id.name)
150-
db.flush()
151-
uploads_info = ', '.join('Upload={0} for Feed={1}'.format(u.id, u.feed_id) for u in uploads)
150+
for up in uploads:
151+
db.add_next_with_verbose(up, related_id_field=Upload.feed_id.name)
152+
db.commit()
153+
db.refresh(up)
154+
created_uploads.append(up)
155+
uploads_info = ', '.join(
156+
'Upload={0} for Feed={1}'.format(u.id, u.feed_id) for u in created_uploads
157+
)
152158
logger.info(Info.new_upload_created.format(uploads_info=uploads_info))
153159
disable_feeds(db, feeds_to_disable, logger)
154-
return uploads
160+
return created_uploads
155161

156162

157163
def get_process_upload_task_payload(installation_id, upload_id, account_id):

0 commit comments

Comments
 (0)