Compare commits

..

No commits in common. "eba40a4eeeaf0ecb68f5b9e6b56101fc1a23993f" and "6bf8417451bce030f3b122ae681548c4eef721df" have entirely different histories.

2 changed files with 4 additions and 4 deletions

View File

@ -186,7 +186,7 @@ func (b *memoryBackend) ChannelsCreate(name string) (microsub.Channel, error) {
for {
varMicrosub.Add("ChannelsCreate.RandStringBytes", 1)
channel.UID = util.RandStringBytes(24)
result, err := b.database.Exec(`insert into "channels" ("uid", "name", "created_at") values ($1, $2, DEFAULT)`, channel.UID, channel.Name)
result, err := b.database.Exec(`insert into "channels" ("uid", "name", "created_at") values($1, $2, DEFAULT)`, channel.UID, channel.Name)
if err != nil {
log.Println("channels insert", err)
if !shouldRetryWithNewUID(err, try) {
@ -195,7 +195,7 @@ func (b *memoryBackend) ChannelsCreate(name string) (microsub.Channel, error) {
try++
continue
}
if n, err := result.RowsAffected(); err == nil {
if n, err := result.RowsAffected(); err != nil {
if n > 0 {
b.broker.Notifier <- sse.Message{Event: "new channel", Object: channelMessage{1, channel}}
}

View File

@ -127,7 +127,7 @@ WHERE "channel_id" = $1
log.Println(err)
} else {
args = append(args, b)
qb.WriteString(` AND "published_at" > $2`)
qb.WriteString(` AND "published_at" >= $2`)
}
} else if after != "" {
b, err := time.Parse(time.RFC3339, after)
@ -196,7 +196,7 @@ WHERE "channel_id" = $1
}
func hasMoreBefore(conn *sql.Conn, before string) bool {
row := conn.QueryRowContext(context.Background(), `SELECT COUNT(*) FROM "items" WHERE "published_at" > $1`, before)
row := conn.QueryRowContext(context.Background(), `SELECT COUNT(*) FROM "items" WHERE "published_at" >= $1`, before)
var count int
if err := row.Scan(&count); err == sql.ErrNoRows {
return false