Details
- Reviewers
machniak - Group Reviewers
Syncroton Developers - Commits
- rSa6d45341475d: Sleep after the loop so we can respond immediately
Diff Detail
- Repository
- rS syncroton
- Lint
Lint Skipped - Unit
No Test Coverage - Build Status
Buildable 53106 Build 18837: arc lint + arc unit
Event Timeline
| lib/ext/Syncroton/Command/Ping.php | ||
|---|---|---|
| 263 | Before we go to sleep I would check whether there is enough time left to do that. | |
| lib/ext/Syncroton/Command/Ping.php | ||
|---|---|---|
| 263 | goToSleep already adjusts the sleep time to the available minimum (worst case 0 seconds). | |
| lib/ext/Syncroton/Command/Ping.php | ||
|---|---|---|
| 263 | No, it does not. $lifeTime never changes as far as I see. Maybe you should use $secondsLeft instead. | |
| lib/ext/Syncroton/Command/Ping.php | ||
|---|---|---|
| 263 | You are right, I confused the two. We are only taking care of the case where lifeTime is set to less than sleep time there. | |
| lib/ext/Syncroton/Command/Ping.php | ||
|---|---|---|
| 129 | $secondsLeft here is wrong and confusing. Please, remove this line. | |
| 275 | Shouldn't we use min(Syncroton_Registry::getPingTimeout(), $lifeTime) here too? And because both arguments are constant at this point, I'd calculate the wait-time before the loop for clarity. | |
| lib/ext/Syncroton/Command/Ping.php | ||
|---|---|---|
| 275 | Maybe we can clarify it somehow, but the logic is (I think):
So we don't attempt to sleep up until the end, we just don't do the final iteration, and the min() in sleep is essentially a special case mostly for testing. so I would just leave it as it is, because it maintains the logic the way it used to be. | |
| lib/ext/Syncroton/Command/Ping.php | ||
|---|---|---|
| 275 | I think the min is actually useless now, it was only relevant when we used to run the first sleep, and then checked for secondsLeft, but now we will simply break before when we check secondsLeft. | |
We either have time left to sleep, or we break. So no point in having the min anymore.