mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-09-17 16:56:38 +08:00
opt: add lock for mj task callback
This commit is contained in:
parent
18c033d57f
commit
ebd3ef842f
@ -93,7 +93,7 @@ func (h *ChatHandler) ChatHandle(c *gin.Context) {
|
|||||||
Id: chatModel.Id,
|
Id: chatModel.Id,
|
||||||
Value: chatModel.Value,
|
Value: chatModel.Value,
|
||||||
Platform: types.Platform(chatModel.Platform)}
|
Platform: types.Platform(chatModel.Platform)}
|
||||||
logger.Infof("New websocket connected, IP: %s, Username: %s", c.Request.RemoteAddr, session.Username)
|
logger.Infof("New websocket connected, IP: %s, Username: %s", c.ClientIP(), session.Username)
|
||||||
var chatRole model.ChatRole
|
var chatRole model.ChatRole
|
||||||
res = h.db.First(&chatRole, roleId)
|
res = h.db.First(&chatRole, roleId)
|
||||||
if res.Error != nil || !chatRole.Enable {
|
if res.Error != nil || !chatRole.Enable {
|
||||||
|
@ -85,7 +85,7 @@ func (h *MidJourneyHandler) Notify(c *gin.Context) {
|
|||||||
logger.Debugf("收到 MidJourney 回调请求:%+v", data)
|
logger.Debugf("收到 MidJourney 回调请求:%+v", data)
|
||||||
h.lock.Lock()
|
h.lock.Lock()
|
||||||
defer h.lock.Unlock()
|
defer h.lock.Unlock()
|
||||||
|
|
||||||
// the job is saved
|
// the job is saved
|
||||||
var job model.MidJourneyJob
|
var job model.MidJourneyJob
|
||||||
res := h.db.Where("message_id = ?", data.MessageId).First(&job)
|
res := h.db.Where("message_id = ?", data.MessageId).First(&job)
|
||||||
|
Loading…
Reference in New Issue
Block a user