From 34a3ff0830f606dcd20d012ce14cc3472397fc45 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期二, 26 九月 2023 17:48:00 +0800
Subject: [PATCH] 下发任务加个锁
---
api/v1/task.go | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/api/v1/task.go b/api/v1/task.go
index 8de652b..5765d4d 100644
--- a/api/v1/task.go
+++ b/api/v1/task.go
@@ -20,6 +20,7 @@
"github.com/gin-gonic/gin"
"gorm.io/gorm"
"sort"
+ "sync"
"time"
)
@@ -248,6 +249,8 @@
ctx.Ok()
}
+var mutex sync.Mutex
+
// TaskStart
// @Tags Task
// @Summary 涓嬪彂宸ヨ壓鍙傛暟锛堝紑濮嬩换鍔★級
@@ -256,6 +259,8 @@
// @Success 200 {object} contextx.Response{service.GetProcessModel} "鎴愬姛"
// @Router /v1/task/sendProcessParams [post]
func (slf *TaskApi) TaskStart(c *gin.Context) {
+ mutex.Lock()
+ defer mutex.Unlock()
var params request.SendProcessParams
ctx, ok := contextx.NewContext(c, ¶ms)
if !ok {
--
Gitblit v1.8.0