From 8a337e744ba5fefa3d897216e7c08af8ffd9699b Mon Sep 17 00:00:00 2001 From: Denis Makogon Date: Thu, 7 Sep 2017 15:16:18 +0300 Subject: [PATCH] Addresing new comments --- api/agent/agent.go | 3 ++- api/agent/call.go | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/api/agent/agent.go b/api/agent/agent.go index 2dd1329e1..d8aa525d6 100644 --- a/api/agent/agent.go +++ b/api/agent/agent.go @@ -222,7 +222,8 @@ func (a *agent) Submit(callI Call) error { a.stats.Complete() - // TODO if the context is timed out here we need to allocate new one + // TODO: we need to allocate more time to store the call + logs in case the call timed out, + // but this could put us over the timeout if the call did not reply yet (need better policy). ctx = opentracing.ContextWithSpan(context.Background(), span) call.End(ctx, err) diff --git a/api/agent/call.go b/api/agent/call.go index 3d58dc147..033561b3e 100644 --- a/api/agent/call.go +++ b/api/agent/call.go @@ -287,7 +287,10 @@ func (c *call) End(ctx context.Context, err error) { // XXX (reed): delete MQ message, eventually } - if err := c.ds.InsertCall(opentracing.ContextWithSpan(ctx, span), c.Call); err != nil { + // this means that we could potentially store an error / timeout status for a + // call that ran successfully [by a user's perspective] + // TODO: this should be update, really + if err := c.ds.InsertCall(ctx, c.Call); err != nil { logrus.WithError(err).Error("error inserting call into datastore") } }