-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/30192/#review69714
-----------------------------------------------------------


Hm.. with this approach the caller is still limited even though they discarded. 
Per our chat with Jie, could we go to discarded early but keep them in the 
queue still?


3rdparty/libprocess/include/process/limiter.hpp
<https://reviews.apache.org/r/30192/#comment114446>

    This is a bit confusing to me, couldn't you just say that "Discarding this 
future cancels the acquisition."? Then it's obvious that the cancelled 
acquisition has no effect, no need to spell it out?



3rdparty/libprocess/include/process/limiter.hpp
<https://reviews.apache.org/r/30192/#comment114449>

    Do you want to just pull it down to treat in block similarly?
    
    ```
    if (!promises.empty()) {
      // Need to wait for others to get permits first.
      ...
      return ...;
    }
    
    if (timeout.remaining() > Seconds(0)) {
      // Need to wait a bit longer, but first one in the queue.
      ...
      return ...;
    }
    
    // No need to wait!
    ...
    return ...;
    ```
    
    Or use else?
    
    ```
    if (!promises.empty()) {
      // Need to wait for others to get permits first.
      ...
      return ...;
    } else if (timeout.remaining() > Seconds(0)) {
      // Need to wait a bit longer, but first one in the queue.
      ...
      return ...;
    } else {
      // No need to wait!
      ...
      return ...;
    }
    ...
    ```
    
    First one seems a bit easier to read?



3rdparty/libprocess/include/process/limiter.hpp
<https://reviews.apache.org/r/30192/#comment114465>

    They are all pending, it's just that some of them have a discard request :)
    
    Mind updating the comment?


- Ben Mahler


On Jan. 27, 2015, 12:18 a.m., Vinod Kone wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/30192/
> -----------------------------------------------------------
> 
> (Updated Jan. 27, 2015, 12:18 a.m.)
> 
> 
> Review request for mesos, Ben Mahler and Jie Yu.
> 
> 
> Bugs: MESOS-2230
>     https://issues.apache.org/jira/browse/MESOS-2230
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> I tried/implemented a complex solution involving list iterators and removing 
> discarded promises from the list, but it was hard to reason about the 
> correctness and race conditions. So abandoned it in favor of a simpler 
> solution. Let me know what you think.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/limiter.hpp 
> a1c4f189565003f19f8b33c3b8a81e28836069c1 
>   3rdparty/libprocess/src/tests/limiter_tests.cpp PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/30192/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Vinod Kone
> 
>

Reply via email to