I use horde component for my php application. I do fetch of some single mail by its uid. The code is following:
$fetchQuery = new \Horde_Imap_Client_Fetch_Query();
$fetchQuery->fullText(['peek' => true]);
$fetchQuery->flags();
$fetchQuery->uid();
$results = $this->imapClient->fetch(
$mailbox,
$fetchQuery, [
'ids' => new \Horde_Imap_Client_Ids($uid),
'nocache' => true
]);
Simple code, works well, nothing unusual. Usually fetching takes couple seconds, but sometimes it takes several minutes. I need to set timeout for fetching. Ideally if fetching takes more time than timeout fetch should return null or something like this. Or maybe exception which I can handle. I don't want change execution_time or similar - it is ugly.