Update list date on import before notif and run notif as a goroutine
This commit is contained in:
parent
8701cb445a
commit
3a6f15e9dc
3
main.go
3
main.go
|
@ -200,7 +200,8 @@ func main() {
|
||||||
|
|
||||||
// Initialize the bulk subscriber importer.
|
// Initialize the bulk subscriber importer.
|
||||||
importNotifCB := func(subject string, data map[string]interface{}) error {
|
importNotifCB := func(subject string, data map[string]interface{}) error {
|
||||||
return sendNotification(notifTplImport, subject, data, app)
|
go sendNotification(notifTplImport, subject, data, app)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
app.Importer = subimporter.New(q.UpsertSubscriber.Stmt,
|
app.Importer = subimporter.New(q.UpsertSubscriber.Stmt,
|
||||||
q.UpsertBlacklistSubscriber.Stmt,
|
q.UpsertBlacklistSubscriber.Stmt,
|
||||||
|
|
|
@ -277,12 +277,10 @@ func (s *Session) Start() {
|
||||||
if cur == 0 {
|
if cur == 0 {
|
||||||
s.im.setStatus(StatusFinished)
|
s.im.setStatus(StatusFinished)
|
||||||
s.log.Printf("imported finished")
|
s.log.Printf("imported finished")
|
||||||
s.im.sendNotif(StatusFinished)
|
|
||||||
|
|
||||||
if _, err := s.im.updateListDate.Exec(listIDs); err != nil {
|
if _, err := s.im.updateListDate.Exec(listIDs); err != nil {
|
||||||
s.log.Printf("error updating lists date: %v", err)
|
s.log.Printf("error updating lists date: %v", err)
|
||||||
}
|
}
|
||||||
|
s.im.sendNotif(StatusFinished)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,11 +296,10 @@ func (s *Session) Start() {
|
||||||
s.im.incrementImportCount(cur)
|
s.im.incrementImportCount(cur)
|
||||||
s.im.setStatus(StatusFinished)
|
s.im.setStatus(StatusFinished)
|
||||||
s.log.Printf("imported finished")
|
s.log.Printf("imported finished")
|
||||||
s.im.sendNotif(StatusFinished)
|
|
||||||
|
|
||||||
if _, err := s.im.updateListDate.Exec(listIDs); err != nil {
|
if _, err := s.im.updateListDate.Exec(listIDs); err != nil {
|
||||||
s.log.Printf("error updating lists date: %v", err)
|
s.log.Printf("error updating lists date: %v", err)
|
||||||
}
|
}
|
||||||
|
s.im.sendNotif(StatusFinished)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop stops an active import session.
|
// Stop stops an active import session.
|
||||||
|
|
Loading…
Reference in New Issue