esd-projects / esd-server Goto Github PK
View Code? Open in Web Editor NEW⚡️ EasySwoole Distributed
Home Page: https://www.kancloud.cn/tmtbe/goswoole/1067764
License: Apache License 2.0
⚡️ EasySwoole Distributed
Home Page: https://www.kancloud.cn/tmtbe/goswoole/1067764
License: Apache License 2.0
举个搭建TCP服务的例子啊
自定义一个 @around("within(ESD\Core\Server\Port\IServerPort+) && execution(public **->onHttpRequest(*))")的切面
用来验证token的合法性。
当客户端同时发起多个请求,服务端通过打印log发现,当所有请求token都合法的时候,切面执行到$invocation->proceed();
最后一个请求,无法进入RouteAspect切面,导致没有回包数据
这个场景是在work_num = 1的时候出现的,当work_num>1则没问题
按照我自己的理解:
当work_num = 1的时候,所有请求都是由这个work进程来处理,某些原因或bug导致链路没执行完成
当work_num >1 请求分散给不同的work进程,相当于每个进程都只处理了一个请求,所以没复现这个情况
但是当高并发的时候,不可避免每个进程还是得同时处理多个请求,也就是这个情况有很大几率复现
错误信息
Error: Call to undefined method Swoole\Http\Server::isEstablished() in /mnt/sdc/dev/www/baiguangDev/esd/vendor/esd/esd-core/src/Core/Server/Server.php:677
使用命令生成实体类
php start_server.php entity -t mx_test
实体类如下:
<?php
namespace App\Model\Entity;
use ESD\Go\GoModel;
use ESD\Plugins\Validate\Annotation\Filter;
use ESD\Plugins\Validate\Annotation\Validated;
/**
* 测试表
*
* Class Test
*/
class Test extends GoModel
{
/**
* id
* @Validated(required=true, number=true)
* @var integer
*/
public $id;
/**
* 名称
* @Validated(required=true, length=true, max=255)
* @var string
*/
public $name;
/**
* 创建时间
* @Validated(required=true, number=true)
* @var integer
*/
public $create_at;
/**
* 更新时间
* @Validated(required=true, number=true)
* @var integer
*/
public $updated_at;
/**
* 获取数据库表名
*
* @return string
*/
public static function getTableName(): string
{
return "test";
}
/**
* 获取主键名
*
* @return string
*/
public static function getPrimaryKey(): string
{
return "id";
}
}
执行代码如下:
/**
* @GetMapping("/")
*/
public function index()
{
$test = Test::select(1);
}
报错如下:
parameter create at is required!
根据官方文档, composer require "esd/esd-server" 安装vendor,
跟着 php ./vendor/esd/esd-server/Install.php 安装框架,
启动服务 php start_server.php start
就报了这个错误,但是服务时已经启动了的
ps:第一次issue,请见谅,因为不知道到哪里提bug,就issue了
model属性不使用验证器注解,获取出来数据为null。是bug还是有其它解决方法呢?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.