func readFeed(c *api.SyncGatewayClient, feedType, lastSeq string) string { feed := c.GetChangesFeed(feedType, lastSeq) ids := []string{} for _, doc := range feed["results"].([]interface{}) { ids = append(ids, doc.(map[string]interface{})["id"].(string)) } if len(ids) == 1 { c.GetSingleDoc(ids[0]) } else { for docs := range RevsIterator(ids) { c.GetBulkDocs(docs) } } return feed["last_seq"].(string) }
func measurePullLatency(c *api.SyncGatewayClient, doc api.Doc) (int64, float64) { t0 := time.Now() c.GetSingleDoc(doc.Id) t1 := time.Now().Round(100 * time.Microsecond) return t0.UnixNano(), float64(t1.Sub(t0.Round(100*time.Microsecond))) / math.Pow10(6) }