Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Active Idle Service Stops Fetching after 30mins - 45 mins #44

Closed
narguelles opened this issue Nov 4, 2020 · 6 comments
Closed

Active Idle Service Stops Fetching after 30mins - 45 mins #44

narguelles opened this issue Nov 4, 2020 · 6 comments
Labels
bug Something isn't working validated

Comments

@narguelles
Copy link

narguelles commented Nov 4, 2020

Describe the bug
Active Idle Service running from CLI or Running Service stops Fetching after 30mins - 45 mins

Code used.

public function handle() {
    
    if (is_array($this->account)) {
        $client = Client::make($this->account);
    }else{
    
        $oClient = Client::account('default');
    }

    try {

        $client = $oClient->connect();

    } catch (ConnectionFailed $e) {
  
        Log::error($e->getMessage());
        return 1;
    }
    $message_mask = \Webklex\PHPIMAP\Support\Masks\MessageMask::class;
    $client->setDefaultMessageMask($message_mask);
    /** @var Folder $folder */
    try {
        $folder = $client->getFolder("INBOX");
     
    } catch (ConnectionFailedException $e) {
        Log::error($e->getMessage());
        return 1;
    } catch (FolderFetchingException $e) {
        Log::error($e->getMessage());
        return 1;
    }

    try {
        $folder->idle(function($message){
            $this->info($message->getSubject());
            // dump("new message", $message->subject);
        });
   
    } catch (\Exception $e) {
        Log::error($e->getMessage());
        return 1;
    }

}

Desktop / Server (please complete the following information):

  • OS: WIndows 10 / Ubuntu 20.04
  • PHP: 7.2,5
  • Version 2.2.3
@Webklex
Copy link
Owner

Webklex commented Nov 4, 2020

Hi @narguelles ,
I assume it fails? Or how are you determining the state? If it fails indeed, please take a look at you logs and look for the related stack trace.

Best regards,

@narguelles
Copy link
Author

Thanks, it stops on client->connect if it has reconnected for 3-5 times.

@Webklex
Copy link
Owner

Webklex commented Nov 6, 2020

Hi @narguelles ,
I don't fully understand how to reproduce it. You mean in your above mentioned code sample, the program stops on line 12 ($client = $oClient->connect();) if the command has run multiple times and wont throw an error just "halt" there?

Best regards,

@narguelles
Copy link
Author

catch (\Webklex\PHPIMAP\Exceptions\RuntimeException $e) {
if(strpos($e->getMessage(), "connection closed") === false) {
throw $e;
}else{
$this->info('Reconnect');
$client->connect();
$client->openFolder($folder->path);
$connection = $client->getConnection();
$connection->idle();
$this->info('idle');
}
}

It reconnects to 4-5 times, after that it just stops at the $client->connect

@Webklex Webklex added bug Something isn't working validated labels Dec 11, 2020
Webklex added a commit that referenced this issue Dec 11, 2020
@Webklex
Copy link
Owner

Webklex commented Dec 11, 2020

Hi @narguelles ,
thanks again for your report 👍

Please update your php-imap dependency to v2.2.5.

Best regards,

@Webklex Webklex closed this as completed Dec 11, 2020
@narguelles
Copy link
Author

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working validated
Projects
None yet
Development

No branches or pull requests

2 participants