chore(sogo-ealarms-notify): properly close all DB channels

This prevent MySQL from logging an error (Aborted connection to db).
This commit is contained in:
Francis Lachapelle
2021-08-12 15:39:12 -04:00
parent 7d07ddaffd
commit cf40a23b43
4 changed files with 39 additions and 6 deletions
+21
View File
@@ -399,6 +399,27 @@ static NSTimeInterval ChannelCollectionTimer = 5 * 60;
}
}
- (void) releaseAllChannels
{
EOAdaptorChannel *channel;
GCSChannelHandle *handle;
NSEnumerator *e;
e = [busyChannels objectEnumerator];
while ((handle = [e nextObject]))
{
[handle retain];
ASSIGN (handle->lastReleaseTime, [NSCalendarDate date]);
[busyChannels removeObject: handle];
channel = [handle channel];
if (debugPools)
[self logWithFormat: @"releaseAllChannels: freeing old channel (age %ds, %p) ", (int)[handle age], channel];
if ([channel isOpen])
[channel closeChannel];
[handle release];
}
}
/* checking for tables */
- (BOOL) canConnect: (NSURL *) _url