附近小店
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

task_order_store_settle.go 335 B

2 months ago
12345678910111213141516171819202122
  1. package task
  2. import (
  3. "applet/app/task/svc"
  4. "math/rand"
  5. "time"
  6. "xorm.io/xorm"
  7. )
  8. func taskOrderStoreSettle(eg *xorm.Engine, dbName string) {
  9. for {
  10. if len(ch) > workerNum {
  11. time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000)))
  12. } else {
  13. goto START
  14. }
  15. }
  16. START:
  17. ch <- 1
  18. svc.OrderStoreSettle(eg, dbName)
  19. <-ch
  20. }