()
| 45 | } |
| 46 | |
| 47 | func (this *MongoDBMgr) Start() { |
| 48 | var err error |
| 49 | this.session, err = mgo.DialWithTimeout(this.dbcfg.String(), this.timeout) |
| 50 | if err != nil { |
| 51 | e := &event.ComponentEventMsg{} |
| 52 | e.MsgType = event.EVENT_COMPONENT_ERROR |
| 53 | e.Sender = this |
| 54 | e.Attach = err |
| 55 | this.m.PushEventMsg(e) |
| 56 | return |
| 57 | } |
| 58 | |
| 59 | this.session.SetMode(mgo.Monotonic, true) |
| 60 | slog.LogInfo("mongodb", "MongoDB Connect success") |
| 61 | } |
| 62 | |
| 63 | func (this *MongoDBMgr) Close() { |
| 64 | if this.session != nil { |
nothing calls this directly
no test coverage detected