[TwitterBridge][DAEMONS] Fix database connection clean-up

This commit is contained in:
Alexei Sorokin 2020-08-24 15:43:14 +03:00 committed by Diogo Peralta Cordeiro
parent 681aa5b326
commit 8290b137fa
2 changed files with 20 additions and 4 deletions

View File

@ -105,7 +105,11 @@ class SyncTwitterFriendsDaemon extends ParallelizingDaemon
$conn->disconnect(); $conn->disconnect();
global $_DB_DATAOBJECT; global $_DB_DATAOBJECT;
unset($_DB_DATAOBJECT['CONNECTIONS']); foreach ($_DB_DATAOBJECT['CONNECTIONS'] as $k => $v) {
if ($v === $conn) {
unset($_DB_DATAOBJECT['CONNECTIONS'][$k]);
}
}
return $flinks; return $flinks;
} }
@ -129,7 +133,11 @@ class SyncTwitterFriendsDaemon extends ParallelizingDaemon
// XXX: Couldn't find a less brutal way to blow // XXX: Couldn't find a less brutal way to blow
// away a cached connection // away a cached connection
global $_DB_DATAOBJECT; global $_DB_DATAOBJECT;
unset($_DB_DATAOBJECT['CONNECTIONS']); foreach ($_DB_DATAOBJECT['CONNECTIONS'] as $k => $v) {
if ($v === $conn) {
unset($_DB_DATAOBJECT['CONNECTIONS'][$k]);
}
}
} }
public function fetchTwitterFriends(Foreign_link $flink) public function fetchTwitterFriends(Foreign_link $flink)

View File

@ -128,7 +128,11 @@ class TwitterStatusFetcher extends ParallelizingDaemon
unset($flink); unset($flink);
$conn->disconnect(); $conn->disconnect();
unset($_DB_DATAOBJECT['CONNECTIONS']); foreach ($_DB_DATAOBJECT['CONNECTIONS'] as $k => $v) {
if ($v === $conn) {
unset($_DB_DATAOBJECT['CONNECTIONS'][$k]);
}
}
return $flinks; return $flinks;
} }
@ -153,7 +157,11 @@ class TwitterStatusFetcher extends ParallelizingDaemon
// XXX: Couldn't find a less brutal way to blow // XXX: Couldn't find a less brutal way to blow
// away a cached connection // away a cached connection
global $_DB_DATAOBJECT; global $_DB_DATAOBJECT;
unset($_DB_DATAOBJECT['CONNECTIONS']); foreach ($_DB_DATAOBJECT['CONNECTIONS'] as $k => $v) {
if ($v === $conn) {
unset($_DB_DATAOBJECT['CONNECTIONS'][$k]);
}
}
} }
public function getTimeline(Foreign_link $flink, $timelineUri = 'home_timeline') public function getTimeline(Foreign_link $flink, $timelineUri = 'home_timeline')