diff --git a/app/multitenant/memcache_client.go b/app/multitenant/memcache_client.go index 732592e99..3b9db267e 100644 --- a/app/multitenant/memcache_client.go +++ b/app/multitenant/memcache_client.go @@ -208,14 +208,9 @@ func (c *MemcacheClient) FetchReports(keys []string) (map[string]report.Report, func (c *MemcacheClient) StoreReport(key string, report *report.Report) (int, error) { var buf bytes.Buffer report.WriteBinary(&buf, c.compressionLevel) - err := c.StoreBytes(key, buf.Bytes()) - return buf.Len(), err -} - -// StoreBytes stores a report, expecting the report to be serialized already. -func (c *MemcacheClient) StoreBytes(key string, content []byte) error { - return instrument.TimeRequestHistogramStatus("Put", memcacheRequestDuration, memcacheStatusCode, func() error { - item := memcache.Item{Key: key, Value: content, Expiration: c.expiration} + err := instrument.TimeRequestHistogramStatus("Put", memcacheRequestDuration, memcacheStatusCode, func() error { + item := memcache.Item{Key: key, Value: buf.Bytes(), Expiration: c.expiration} return c.client.Set(&item) }) + return buf.Len(), err } diff --git a/app/multitenant/s3_client.go b/app/multitenant/s3_client.go index 48fff4f19..9e1aaaeac 100644 --- a/app/multitenant/s3_client.go +++ b/app/multitenant/s3_client.go @@ -91,19 +91,13 @@ func (store *S3Store) fetchReport(key string) (*report.Report, error) { func (store *S3Store) StoreReport(key string, report *report.Report) (int, error) { var buf bytes.Buffer report.WriteBinary(&buf, gzip.BestCompression) - err := store.StoreBytes(key, buf.Bytes()) - return buf.Len(), err -} - -// StoreBytes stores a report in S3, expecting the report to be serialized -// already. -func (store *S3Store) StoreBytes(key string, content []byte) error { - return instrument.TimeRequestHistogram("Put", s3RequestDuration, func() error { + err := instrument.TimeRequestHistogram("Put", s3RequestDuration, func() error { _, err := store.s3.PutObject(&s3.PutObjectInput{ - Body: bytes.NewReader(content), + Body: bytes.NewReader(buf.Bytes()), Bucket: aws.String(store.bucketName), Key: aws.String(key), }) return err }) + return buf.Len(), err }