Closed jakubboucek closed 2 years ago
Merging #548 (f41a047) into master (650e43d) will increase coverage by
0.00%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## master #548 +/- ##
=========================================
Coverage 95.58% 95.58%
Complexity 357 357
=========================================
Files 45 45
Lines 838 839 +1
=========================================
+ Hits 801 802 +1
Misses 37 37
Impacted Files | Coverage Δ | |
---|---|---|
src/Connection.php | 88.73% <100.00%> (+0.16%) |
:arrow_up: |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
because calling of
$this->resource->getStream()
is refill cache cleared on previous line.
That's intended: what's your issue about this?
Sometime is occured error when connection to server is interrupted or server go down for unknown reason. Then we call $imap->close()
to release resouces on client's side.
This bug causes to call imap_reopen()
during closing. That does not make sense and it's consume huge time to connect with dead server and throwing confusing exception when it fail again.
This PR is changing order of call clearLastMailboxUsedCache()
and resource->getStream()
methods to prevent re-open connection to dead server when client obvious want to close it.
The $this->resource->getStream();
call does NOT cause to re-open connection when cache is filled because ImapResource
is trusting to cache and not checking if connections is alive (that's good for performance).
That does not make sense and it's consume huge time to connect with dead server and throwing confusing exception when it fail again.
This PR still raises an Exception when this happens, doesn't it?
Example of bug causes:
$client->close()
to release resources.When I changed code like this PR, it does not throw two Exception, only one, which is handled.
Released in 1.14.2
, thank you
Thx ❤️
This semantic is wrong:
https://github.com/ddeboer/imap/blob/c8e26a01ba4367fc4ae9536633c462d92cbca8d8/src/Connection.php#L51-L56
because calling of
$this->resource->getStream()
is refill cache cleared on previous line.This PR is change call order to prevent refill cache with reference to closed resource.