Fix validator bugs

This commit is contained in:
Kevin Cotugno 2017-10-10 22:38:15 -07:00
parent b1b12ac06e
commit 7a1e1fd8d8
3 changed files with 7 additions and 3 deletions

View File

@ -20,6 +20,10 @@ CREATE TABLE confirmations (
type CHAR(1) NOT NULL, type CHAR(1) NOT NULL,
last_id INTEGER NOT NULL DEFAULT 0); last_id INTEGER NOT NULL DEFAULT 0);
CREATE UNIQUE INDEX confirmations_product_type_index ON confirmations (
product,
type);
CREATE TABLE aggregations ( CREATE TABLE aggregations (
id SERIAL PRIMARY KEY, id SERIAL PRIMARY KEY,
interval integer NOT NULL, interval integer NOT NULL,

View File

@ -50,7 +50,7 @@ func (a *AggregationValidator) Stop() {
func (a *AggregationValidator) emitProducts() { func (a *AggregationValidator) emitProducts() {
for _, p := range a.Products { for _, p := range a.Products {
go a.validate(p) a.validate(p)
} }
} }

View File

@ -29,7 +29,7 @@ const (
trade_product = `SELECT DISTINCT product FROM trades;` trade_product = `SELECT DISTINCT product FROM trades;`
trade_after_all = `SELECT id,` + trade_columns + `FROM trades WHERE product = $1 ` + trade_after_all = `SELECT id,` + trade_columns + `FROM trades WHERE product = $1 ` +
`AND trade_id >= $2 ORDER BY trade_id ASC;` `AND trade_id >= $2 ORDER BY trade_id ASC;`
trade_where = `SELECT id, ` + trade_columns + `WHERE` trade_where = `SELECT id,` + trade_columns + `FROM trades WHERE`
) )
type TradeService struct { type TradeService struct {
@ -163,7 +163,7 @@ func (s *TradeService) TradesWhere(sql string, params ...interface{}) ([]tacitus
s.client.logQuery(stmt, params...) s.client.logQuery(stmt, params...)
rows, err := s.client.db.Query(stmt, params) rows, err := s.client.db.Query(stmt, params...)
if err != nil { if err != nil {
s.client.logError(stmt, err, params...) s.client.logError(stmt, err, params...)