mirror of
https://github.com/friendica/friendica
synced 2025-04-28 12:24:23 +02:00
Count inbound and outbound packets
This commit is contained in:
parent
ca5f93a4d5
commit
e011b5956a
13 changed files with 63 additions and 0 deletions
|
@ -4265,4 +4265,22 @@ class Item
|
|||
Logger::warning('Post does not exist although it was supposed to had been fetched.', ['id' => $id, 'url' => $url, 'uid' => $uid]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static function incrementInbound(string $network)
|
||||
{
|
||||
$packets = DI::keyValue()->get('stats_packets_inbound_' . $network) ?? 0;
|
||||
if ($packets >= PHP_INT_MAX) {
|
||||
$packets = 0;
|
||||
}
|
||||
DI::keyValue()->set('stats_packets_inbound_' . $network, $packets + 1);
|
||||
}
|
||||
|
||||
public static function incrementOutbound(string $network)
|
||||
{
|
||||
$packets = DI::keyValue()->get('stats_packets_outbound_' . $network) ?? 0;
|
||||
if ($packets >= PHP_INT_MAX) {
|
||||
$packets = 0;
|
||||
}
|
||||
DI::keyValue()->set('stats_packets_outbound_' . $network, $packets + 1);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue