Skip to content

Cache informaton about Talk desktop usage #1769

@ChristophWurst

Description

@ChristophWurst

Steps to reproduce

  1. Enable the app
  2. Trigger operations that cause a notification

Expected behaviour

Lean datatabase usage.

Actual behaviour

Excessive database usage for information that changes rarely. On my personal instance with fairly little activity the name lookup in oc_authtoken is the second most executed query on the authtoken table. Details are found in nextcloud/server#42574.

public function hasTalkDesktop(string $userId, int $maxAge = 0): bool {
$query = $this->connection->getQueryBuilder();
$query->select('name')
->from('authtoken')
->where($query->expr()->eq('uid', $query->createNamedParameter($userId)));
if ($maxAge !== 0) {
$query->andWhere($query->expr()->gte(
'last_activity',
$query->createNamedParameter($maxAge, IQueryBuilder::PARAM_INT)
));
}
$result = $query->executeQuery();
while ($row = $result->fetch()) {
if (preg_match('/ \(Talk Desktop Client - [A-Za-z ]+\)$/', $row['name'])) {
$result->closeCursor();
return true;
}
}
$result->closeCursor();
return false;
}
}

We can cache this information, even if it's just for a few minutes.

Server configuration

Operating system:

Web server:

Database:

PHP version:

Nextcloud version: 26.0.9

Where did you install Nextcloud from:

Signing status:

Login as admin user into your Nextcloud and access
http://example.com/index.php/settings/integrity/failed 
paste the results here.

List of activated apps:

If you have access to your command line run e.g.:
sudo -u www-data php occ app:list
from within your Nextcloud installation folder

Nextcloud configuration:

If you have access to your command line run e.g.:
sudo -u www-data php occ config:list system
from within your Nextcloud installation folder

or 

Insert your config.php content here
Make sure to remove all sensitive content such as passwords. (e.g. database password, passwordsalt, secret, smtp password, …)

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...

Client configuration

Browser:

Operating system:

Logs

Nextcloud log (data/nextcloud.log)

Insert your Nextcloud log here

Browser log

Insert your browser log here, this could for example include:

a) The javascript console log
b) The network log 
c) ...

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions