1212use OCA \Mail \Account ;
1313use OCA \Mail \Exception \IncompleteSyncException ;
1414use OCA \Mail \Exception \ServiceException ;
15+ use OCA \Mail \IMAP \IMAPClientFactory ;
1516use OCA \Mail \IMAP \MailboxSync ;
1617use OCA \Mail \Service \AccountService ;
1718use OCA \Mail \Service \Sync \ImapToDbSynchronizer ;
@@ -34,17 +35,20 @@ final class SyncAccount extends Command {
3435 private MailboxSync $ mailboxSync ;
3536 private ImapToDbSynchronizer $ syncService ;
3637 private LoggerInterface $ logger ;
38+ private IMAPClientFactory $ clientFactory ;
3739
3840 public function __construct (AccountService $ service ,
3941 MailboxSync $ mailboxSync ,
4042 ImapToDbSynchronizer $ messageSync ,
41- LoggerInterface $ logger ) {
43+ LoggerInterface $ logger ,
44+ IMAPClientFactory $ clientFactory ) {
4245 parent ::__construct ();
4346
4447 $ this ->accountService = $ service ;
4548 $ this ->mailboxSync = $ mailboxSync ;
4649 $ this ->syncService = $ messageSync ;
4750 $ this ->logger = $ logger ;
51+ $ this ->clientFactory = $ clientFactory ;
4852 }
4953
5054 /**
@@ -95,5 +99,9 @@ private function sync(Account $account, bool $force, OutputInterface $output): v
9599 $ output ->writeln ("<info>Batch of new messages sync'ed. " . $ mbs . 'MB of memory in use</info> ' );
96100 $ this ->sync ($ account , $ force , $ output );
97101 }
102+
103+ foreach ($ this ->clientFactory ->getLoginStats () as $ host => $ count ) {
104+ $ consoleLogger ->debug (sprintf ('%d IMAP connection(s) to %s ' , $ count , $ host ));
105+ }
98106 }
99107}
0 commit comments