sleep 0.5 sec every telegram
This commit is contained in:
+3
-2
@@ -100,6 +100,7 @@ func LoadUnprocessed() {
|
||||
}
|
||||
for _, t := range telegrams {
|
||||
if WriteToClient(t.text) == nil {
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
processed(db, t)
|
||||
}
|
||||
}
|
||||
@@ -137,8 +138,8 @@ func processed(db *sql.DB, t telegram) {
|
||||
checkDbErr(err, "error in create update statement")
|
||||
result, err := stmt.Exec(t.id)
|
||||
checkDbErr(err, "error in update telegram status")
|
||||
id, _ := result.RowsAffected()
|
||||
Log.Info("telegram update : %t", zap.Int64("id", id), zap.Bool("result", id > 0))
|
||||
rows, _ := result.RowsAffected()
|
||||
Log.Info("telegram update : %t", zap.Int64("id", t.id), zap.Bool("result", rows > 0))
|
||||
isWriting = false
|
||||
Log.Info("release lock")
|
||||
tx.Commit()
|
||||
|
||||
Reference in New Issue
Block a user