Extremely slow login after ugrading to 21.0.1

Nextcloud version: 21.0.1
Operating system and version: Void Linux
Apache or nginx version: The version that comes in the docker image
PHP version: The version that comes in the docker image

Since upgrading to Nextcloud 21.0.1 I have been facing extremely long login-times. Before the upgrade, logging in was not blazingly fast but I had my timouts in HAProxy (my nextcloud runs in a docker container behind HAProxy) set to about 30s and it was working fine. After the upgrade, logging in would not work at all and it took me quite a while to figure out that it was the timeouts that were causing the issue. A login takes about 160-170 seconds. If I look at the network debugger in firefox, I can see the POST request for the login, and after about 160s that returns and everything continues as normal. Has anything changed with regards to logging in? Is there anything I can try to improve the login time?

config.php

?php
$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 => 
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'instanceid' => 'xxx',
  'passwordsalt' => 'xxx',
  'secret' => 'xxx',
  'trusted_domains' => 
  array (
    0 => '10.0.0.15:8080',
    1 => 'nextcloud.windestam.se',
  ),
  'trusted_proxies' => 
  array (
    0 => '10.0.0.15',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '21.0.1.1',
  'dbname' => 'nextcloud',
  'dbhost' => 'db',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'xxx',
  'installed' => true,
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpsecure' => 'tls',
  'mail_from_address' => 'nextcloud',
  'mail_domain' => 'windestam.se',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'box.windestam.se',
  'mail_smtpport' => '587',
  'mail_smtpname' => 'xxxx',
  'mail_smtppassword' => 'xxx',
  'maintenance' => false,
  'overwrite.cli.url' => 'http://nextcloud.windestam.se',
  'overwriteprotocol' => 'https',
  'theme' => '',
  'loglevel' => 2,
  'mail_sendmailmode' => 'smtp',
  'auth.bruteforce.protection.enabled' => false,
);

In case anyone comes across this I found the solution, it is the same problem as descibed here:

and here

I run my nextcloud instance in a docker container, and here is the quick guide to how I solved it:

# docker exec -it nextcloud-db-1 /bin/bash
# mariadb -u root -p
> use nextcloud;
> delete from oc_authtoken where login_name = '<your_login_name>';