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

同一个rpc接口,被多个rpc-client 引用注入,多个引用会被最后一个申明覆盖 #1373

Closed
tanpeng opened this issue Sep 22, 2020 · 0 comments · Fixed by swoft-cloud/swoft-component#606
Assignees
Milestone

Comments

@tanpeng
Copy link

tanpeng commented Sep 22, 2020

Q A
Bug report? yes
Feature request? yes
Swoft version 2.0.10
Swoole version 4.5.4
PHP version 7.4
Runtime environment CentOS 7

同一个rpc接口,被多个rpc-client 引用注入,多个引用会被最后一个申明覆盖。
具体场景是我部署了多套rpc-server,Service会根据情况选择一个服务。

    // 我的服务引入代码
    /**
     * @Reference(pool="aps1.pool")
     *
     * @var ApsInterface
     */
    private $aps1Service;

    /**
     * @Reference(pool="aps2.pool")
     *
     * @var ApsInterface
     */
    private $aps2Service;
    // 目前我是强制加了一个是否缓存proxy的控制,rpc-client的proxy就不使用缓存来临时处理了下

  // Swoft\Proxy 47行
    public static function newClassName(string $className, Visitor $visitor, string $suffix = '', bool $useCache = true): string
    {
        $cacheKey = $className . $suffix;
        if ($useCache && isset(self::$caches[$cacheKey])) {
            return self::$caches[$cacheKey];
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants