Skip to content

Commit

Permalink
Workspace-aware HTTPPool.
Browse files Browse the repository at this point in the history
  • Loading branch information
udhos committed Jan 2, 2024
1 parent 45c03a7 commit 4689885
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion http.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ const defaultReplicas = 50

// HTTPPool implements PeerPicker for a pool of HTTP peers.
type HTTPPool struct {
ws *workspace

// this peer's base URL, e.g. "https://example.net:8000"
self string

Expand Down Expand Up @@ -104,6 +106,7 @@ func NewHTTPPoolOptsWithWorkspace(ws *workspace, self string, o *HTTPPoolOptions
ws.httpPoolMade = true

p := &HTTPPool{
ws: ws,
self: self,
httpGetters: make(map[string]*httpGetter),
}
Expand Down Expand Up @@ -186,7 +189,7 @@ func (p *HTTPPool) ServeHTTP(w http.ResponseWriter, r *http.Request) {
key := parts[1]

// Fetch the value for this group/key.
group := GetGroup(groupName)
group := GetGroupWithWorkspace(p.ws, groupName)
if group == nil {
http.Error(w, "no such group: "+groupName, http.StatusNotFound)
return
Expand Down

0 comments on commit 4689885

Please sign in to comment.