重启之后代码概率失效

xiaorui

问题描述

嗯加入了一些新的json 也尝试用reload restart
后端代码概率会丢失之前的json

{"type":"say","from_client_id":"7f00000108fe00000001","from_client_name":"\u79cb\u6708","to_client_id":"all","img":"这是个参数","content":"123","talk":"这也是个参数","time":"2023-05-30 10:52:48"}
这个是正常的
但是 有时候刷新
就会变成第一版

{"type":"say","from_client_id":"7f00000108ff00000004","from_client_name":"\u5929\u9053","to_client_id":"all","content":"123","time":"2023-05-30 11:02:52"}
少了 img talk这个参数

程序代码或配置

$new_message = array(
'type'=>'say',
'from_client_id'=>$client_id,
'from_client_name' =>$client_name,
'to_client_id'=>'all',
'img' => $img,
'content'=>nl2br(htmlspecialchars($message_data['content'])),
'talk'=> $talk,
'time'=>date('Y-m-d H:i:s'),
);
return Gateway::sendToGroup($room_id ,json_encode($new_message));

重现问题的步骤

就是刷新几次 就会出现上个版本的 不加载我现在的文件

操作系统环境及workerman/webman等具体版本

{
"name" : "workerman/workerman-chat",
"type" : "project",
"keywords": ["chat"],
"homepage": "https://www.workerman.net",
"license" : "MIT",
"require": {
"workerman/gateway-worker" : "^v3.0.23||^4.0.0",
"ext-json": "*",
"revolt/event-loop": "^1.0",
"workerman/mysql": "^1.0"
},
"autoload": {
"psr-4": {
"": "./",
"": "./Applications/Chat/"
}
}
}

744 1 0
1个回答

latin

可能是启动了多个gatewayworker,有时候连到其他的gatewayworker进程了。
把现在的服务停了,看下是否有其它gatewayworker进程启动着,如果找不着就重启服务器

  • xiaorui 2023-05-30

    有两个 聊天室 冲突了 俩都重启 就好了

年代过于久远,无法发表回答
×
🔝