#158 discussion_sync: commit after creating each ticket
Merged 3 years ago by kparal. Opened 3 years ago by kparal.

@@ -46,7 +46,7 @@ 

  

          bug.discussion_link = link

          db.session.add(bug)

-     db.session.commit()

+         db.session.commit()

  

  

  def sync_discussions():

I noticed that when I abort sync-discussions with Ctrl+C, some of the tickets
get created, but are not saved in the DB, and therefore another sync-discussions
will create tickets for those bugs again (duplicating, triplicating them, etc).
While I did that with Ctrl+C, a network error could have a similar effect.

When creating discussion tickets, let's commit it to DB after each new ticket is
created. It doesn't slow us down in any meaningful way and it's more error-prone
against errors and therefore multiplicated tickets.

Metadata Update from @kparal:
- Request assigned

3 years ago

Build succeeded.

LGTM, but to be sure, let's wait for @jskladan's opinion.

Sure looks good to me :thumbsup:

Commit 8018285 fixes this pull-request

Pull-Request has been merged by kparal

3 years ago