Skip to content
Snippets Groups Projects
Commit b9dc381b authored by Ashwin's avatar Ashwin
Browse files

handled uidStore querying which is on instance 0

parent 88d5cb6c
No related branches found
No related tags found
No related merge requests found
......@@ -68,21 +68,41 @@ func ProcessTaskOverNetwork(qu []byte) (result []byte, rerr error) {
attr := string(q.Attr())
idx := farm.Fingerprint64([]byte(attr)) % numInstances
if idx == instanceIdx {
return ProcessTask(qu)
} else {
pool := pools[idx]
addr := addrs[idx]
query := new(conn.Query)
query.Data = qu
reply := new(conn.Reply)
if err := pool.Call("Worker.ServeTask", query, reply); err != nil {
glog.WithField("call", "Worker.ServeTask").Fatal(err)
if attr == "_xid_" || attr == "_uid_" {
if instanceIdx == 0 {
return ProcessTask(qu)
} else { // Send the request to instance 0 which has uidstore
pool := pools[0]
addr := addrs[0]
query := new(conn.Query)
query.Data = qu
reply := new(conn.Reply)
if err := pool.Call("Worker.ServeTask", query, reply); err != nil {
glog.WithField("call", "Worker.ServeTask").Fatal(err)
}
glog.WithField("reply", string(reply.Data)).WithField("addr", addr).
Info("Got reply from server")
return reply.Data, nil
}
glog.WithField("reply", string(reply.Data)).WithField("addr", addr).
Info("Got reply from server")
} else {
if idx == instanceIdx {
return ProcessTask(qu)
} else {
pool := pools[idx]
addr := addrs[idx]
query := new(conn.Query)
query.Data = qu
reply := new(conn.Reply)
if err := pool.Call("Worker.ServeTask", query, reply); err != nil {
glog.WithField("call", "Worker.ServeTask").Fatal(err)
}
glog.WithField("reply", string(reply.Data)).WithField("addr", addr).
Info("Got reply from server")
return reply.Data, nil
return reply.Data, nil
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment