Skip to content

[NFR]: Need the lock for redis session #17126

@lanlin

Description

@lanlin

Hi guys,

I think we need to implement a lock for the Redis session.
Without it may cause some unexpected bugs, like login failed,
because of the login request may take a little longer time to init some user data,
but the next request has arrived at the time.

There may have many ways to deal with this, using phpredis's session locking
phpredis session locking

or just add a new method to the session manager to give the chance for some check.
Exp:

    public function hasRetry(string $key): bool
    {
        $has = false;

        for ($i = 0; $i < 100; $i++)
        {
            $has = $this->has($key);

            if ($has) { break; }

            usleep(50000);
        }

        return $has;
    }

Metadata

Metadata

Assignees

Labels

5.0The issues we want to solve in the 5.0 releasenew feature requestPlanned Feature or New Feature Request

Type

No type
No fields configured for issues without a type.

Projects

Status
Implemented

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions