From 9846f05edfaa275bbf4ad820ff7700b6ffa1e026 Mon Sep 17 00:00:00 2001 From: Philip O'Toole Date: Fri, 30 Jan 2015 22:59:52 -0800 Subject: [PATCH] Quit value-less requests as soon as possible --- server.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/server.go b/server.go index 05243af434..5738b9eea4 100644 --- a/server.go +++ b/server.go @@ -1371,6 +1371,11 @@ func (s *Server) WriteSeries(database, retentionPolicy string, points []Point) ( } name, tags, timestamp, values := points[0].Name, points[0].Tags, points[0].Timestamp, points[0].Values + // Ignore requests that have no values. + if len(values) == 0 { + return 0, nil + } + // Find the id for the series and tagset seriesID, err := s.createSeriesIfNotExists(database, name, tags) if err != nil { @@ -1405,11 +1410,6 @@ func (s *Server) WriteSeries(database, retentionPolicy string, points []Point) ( // Find appropriate shard within the shard group. sh := g.ShardBySeriesID(seriesID) - // Ignore requests that have no values. - if len(values) == 0 { - return 0, nil - } - // Convert string-key/values to fieldID-key/values. // If not all fields can be converted then send as a non-raw write series. rawValues := m.mapValues(values)