Minor improvements (#235)

* Minor improvements

* Update CHANGELOG.md
This commit is contained in:
Roman Kelesidis 2023-09-07 17:24:25 +07:00 committed by GitHub
parent 6540946c85
commit 3fe8570726
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 9 deletions

View File

@ -6,6 +6,7 @@
**Merged pull requests:**
- Release v2.1.5-2023.09 🎉
- Minor improvements [\#235](https://github.com/torrentpier/torrentpier-lts/pull/235) ([belomaxorka](https://github.com/belomaxorka))
## [v2.1.5-2023.08](https://github.com/torrentpier/torrentpier-lts/tree/v2.1.5-2023.08) (2023-09-04)
[Full Changelog](https://github.com/torrentpier/torrentpier-lts/compare/v2.1.5-2023.07...v2.1.5-2023.08)

View File

@ -239,7 +239,7 @@ else
if (empty($row['topic_id']))
{
msg_die('Torrent not registered, info_hash = ' . bin2hex($info_hash_sql));
msg_die('Torrent not registered, info_hash = ' . bin2hex($info_hash));
}
if (empty($row['user_id']))
{
@ -487,16 +487,16 @@ if (!$output)
LIMIT 1
");
$seeders = $row['seeders'];
$leechers = $row['leechers'];
$seeders = isset($row['seeders']) ? $row['seeders'] : 0;
$leechers = isset($row['leechers']) ? $row['leechers'] : 0;
}
$output = array(
'interval' => (int) $announce_interval,
'min interval' => (int) $announce_interval,
'peers' => $peers,
'complete' => (int) $seeders,
'incomplete' => (int) $leechers,
'peers' => $peers,
);
$peers_list_cached = CACHE('tr_cache')->set(PEERS_LIST_PREFIX . $topic_id, $output, PEERS_LIST_EXPIRE);
@ -508,4 +508,4 @@ if (!$output)
echo bencode($output);
tracker_exit();
exit;
exit;

View File

@ -61,6 +61,7 @@ $bb_cfg['cache']['memcache'] = array(
$bb_cfg['cache']['redis'] = array(
'host' => '127.0.0.1',
'port' => 6379,
'pconnect' => true,
'con_required' => true,
);

View File

@ -26,10 +26,12 @@ class cache_redis extends cache_common
function connect ()
{
$connect_type = ($this->cfg['pconnect']) ? 'pconnect' : 'connect';
$this->cur_query = 'connect '. $this->cfg['host'] .':'. $this->cfg['port'];
$this->debug('start');
if (@$this->redis->connect($this->cfg['host'], $this->cfg['port']))
if (@$this->redis->$connect_type($this->cfg['host'], $this->cfg['port']))
{
$this->connected = true;
}
@ -113,4 +115,4 @@ class cache_redis extends cache_common
{
return class_exists('Redis');
}
}
}

View File

@ -25,10 +25,12 @@ class datastore_redis extends datastore_common
function connect ()
{
$connect_type = ($this->cfg['pconnect']) ? 'pconnect' : 'connect';
$this->cur_query = 'connect '. $this->cfg['host'] .':'. $this->cfg['port'];
$this->debug('start');
if (@$this->redis->connect($this->cfg['host'],$this->cfg['port']))
if (@$this->redis->$connect_type($this->cfg['host'], $this->cfg['port']))
{
$this->connected = true;
}
@ -103,4 +105,4 @@ class datastore_redis extends datastore_common
{
return class_exists('Redis');
}
}
}