use NamedQueryContext instead of NamedQuery

This commit is contained in:
c9s 2024-06-19 15:51:16 +08:00
parent 26d0fedcec
commit 6afde4808f
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54
2 changed files with 2 additions and 2 deletions

View File

@ -648,7 +648,7 @@ func (environ *Environment) syncSession(
log.Infof("syncing symbols %v from session %s", symbols, session.Name)
syncBufferPeriod := -defaultSyncBufferPeriod
if environ.environmentConfig.SyncBufferPeriod != nil {
if environ.environmentConfig != nil && environ.environmentConfig.SyncBufferPeriod != nil {
syncBufferPeriod = -environ.environmentConfig.SyncBufferPeriod.Duration()
}

View File

@ -335,7 +335,7 @@ func (s *TradeService) Query(options QueryTradesOptions) ([]types.Trade, error)
func (s *TradeService) Load(ctx context.Context, id int64) (*types.Trade, error) {
var trade types.Trade
rows, err := s.DB.NamedQuery("SELECT * FROM trades WHERE id = :id", map[string]interface{}{
rows, err := s.DB.NamedQueryContext(ctx, "SELECT * FROM trades WHERE id = :id", map[string]interface{}{
"id": id,
})
if err != nil {