Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

感觉挺不错的,可以用在生产环境吗? #2

Closed
springleng opened this issue Jan 15, 2018 · 12 comments
Closed

感觉挺不错的,可以用在生产环境吗? #2

springleng opened this issue Jan 15, 2018 · 12 comments

Comments

@springleng
Copy link

No description provided.

@TIGERB
Copy link
Owner

TIGERB commented Jan 15, 2018

完全可以啊~ 哈哈~

@springleng
Copy link
Author

PHP7.1、7.2下报:
PHP Notice: A non well formed numeric value encountered in /vagrant_data/caipiao_api/naruto/src/Daemon.php on line 54

@TIGERB
Copy link
Owner

TIGERB commented Jan 16, 2018

忘了说了 目前只在ubuntu&mac测试过 别的系统没测过,代码 是下面这样么?

public function check(Manager $manager)
	{
		if (! empty($manager->waitSignalProcessPool['signal'])) {
            return;
        }

        // get num now
		$num = shell_exec("pstree -p {$manager->master->pid} | grep php | wc -l") - 3;
		
        // check num
        $diff = $manager->startNum - $num;
        if ($diff > 0) {
            // start worker
            $manager->execFork($diff);   
        }
	}

@TIGERB
Copy link
Owner

TIGERB commented Jan 16, 2018

那块代码挺简单的 就是获取当前子进程的数量的shell 你可以debug下

@springleng
Copy link
Author

类型转换一下就行了 $num = intval(shell_exec("pstree -p {$manager->master->pid} | grep php | wc -l")) - 3;

@TIGERB
Copy link
Owner

TIGERB commented Jan 16, 2018

哦哦,欢迎pr, thx~

不过奇了怪了,不是弱类型么,难道

shell_exec("pstree -p {$manager->master->pid} | grep php | wc -l")

的结果是个非数字的字符串~

wc -l 应该是个数字啊~

@springleng
Copy link
Author

PHP 7 慢慢的再往强类型靠

@TIGERB
Copy link
Owner

TIGERB commented Jan 16, 2018

可以把你那边

shell_exec("pstree -p {$manager->master->pid} | grep php | wc -l")

的结果打印发我么 我看看~

thx~

@springleng
Copy link
Author

qq 20180116173304

应该是多出了一个换行符了,你不说我还真以为是类型的问题

@springleng
Copy link
Author

而且还发现一个问题 --worker-num=1的时候 pa aux | grep php 查看是5个进程

@TIGERB
Copy link
Owner

TIGERB commented Jan 16, 2018

嗯,换行符~

bug欢迎提交 pull request,哈哈~

@TIGERB
Copy link
Owner

TIGERB commented Jan 17, 2018

[而且还发现一个问题 --worker-num=1的时候 pa aux | grep php 查看是5个进程]

已经fix了~

thx~

@TIGERB TIGERB closed this as completed Oct 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants