appview/pulls: notify on stacked pull creation #897

merged
opened by oppi.li targeting master from op/ktnoympkzvpt

the merged_notifier no longer waits for the notifiers to complete. it is now fire-and-forget.

Signed-off-by: oppiliappan me@oppi.li

Changed files
+8 -1
appview
-1
appview/notify/merged_notifier.go
··· 39 39 v.Call(in) 40 40 }(n) 41 41 } 42 - wg.Wait() 43 42 } 44 43 45 44 func (m *mergedNotifier) NewRepo(ctx context.Context, repo *models.Repo) {
+8
appview/pulls/pulls.go
··· 1366 1366 s.pages.Notice(w, "pull", "Failed to create pull request. Try again later.") 1367 1367 return 1368 1368 } 1369 + 1369 1370 } 1370 1371 1371 1372 if err = tx.Commit(); err != nil { ··· 1374 1375 return 1375 1376 } 1376 1377 1378 + // notify about each pull 1379 + // 1380 + // this is performed after tx.Commit, because it could result in a locked DB otherwise 1381 + for _, p := range stack { 1382 + s.notifier.NewPull(r.Context(), p) 1383 + } 1384 + 1377 1385 ownerSlashRepo := reporesolver.GetBaseRepoPath(r, repo) 1378 1386 s.pages.HxLocation(w, fmt.Sprintf("/%s/pulls", ownerSlashRepo)) 1379 1387 }