Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for PickAndAdd (0.27 sec)

  1. pkg/test/loadbalancersim/loadbalancer/edf.go

    	heap.Push(e.pq, &Entry{
    		value:    value,
    		weight:   weight,
    		deadline: e.currentDeadline + 1/weight,
    		index:    e.currentIndex,
    	})
    }
    
    // PickAndAdd picks an available entry and re-adds it with the given weight calculation
    func (e *EDF) PickAndAdd(calcWeight func(prevWeight float64, value any) float64) any {
    	// if no available entry, return nil
    	if len(*e.pq) == 0 {
    		return nil
    	}
    	entry := heap.Pop(e.pq).(*Entry)
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Thu Jul 20 19:13:32 UTC 2023
    - 2.8K bytes
    - Viewed (0)
  2. pkg/test/loadbalancersim/loadbalancer/leastrequest.go

    	}
    
    	return lb
    }
    
    func (lb *weightedLeastRequest) Request(onDone func()) {
    	// Pick the next endpoint and re-add it with the updated weight.
    	lb.edfMutex.Lock()
    	selected := lb.edf.PickAndAdd(lb.calcEDFWeight).(*WeightedConnection)
    	lb.edfMutex.Unlock()
    
    	// Make the request.
    	lb.doRequest(selected, onDone)
    }
    
    func (lb *weightedLeastRequest) calcEDFWeight(_ float64, value any) float64 {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Mon Nov 14 20:23:34 UTC 2022
    - 3.4K bytes
    - Viewed (0)
Back to top