diff --git a/server/store/datastore/agent.go b/server/store/datastore/agent.go index 419f1f13af..3f0ac59165 100644 --- a/server/store/datastore/agent.go +++ b/server/store/datastore/agent.go @@ -43,7 +43,9 @@ func (s storage) AgentFindByToken(token string) (*model.Agent, error) { func (s storage) AgentCreate(agent *model.Agent) error { // only Insert set auto created ID back to object - _, err := s.engine.Insert(agent) + sess := s.engine.NewSession() + defer sess.Close() + _, err := sess.NoVersionCheck().Insert(agent) return err }