chore: filter out perma dead
This commit is contained in:
parent
07aba6d14a
commit
2bb2eec993
12
http.go
12
http.go
@ -114,8 +114,8 @@ func httpServer(ctx context.Context, app *appState) error {
|
|||||||
defer span.End()
|
defer span.End()
|
||||||
|
|
||||||
args := make([]any, 0, 3)
|
args := make([]any, 0, 3)
|
||||||
where := ``
|
where := `where feed_id in (select feed_id from feeds where state != 'permanantly-dead')`
|
||||||
|
|
||||||
uri := r.URL.Query().Get("uri")
|
uri := r.URL.Query().Get("uri")
|
||||||
if uri != "" {
|
if uri != "" {
|
||||||
feed_id := urlNS.UUID5(uri)
|
feed_id := urlNS.UUID5(uri)
|
||||||
@ -135,7 +135,7 @@ func httpServer(ctx context.Context, app *appState) error {
|
|||||||
|
|
||||||
var end int64
|
var end int64
|
||||||
err = db.QueryRowContext(ctx, `
|
err = db.QueryRowContext(ctx, `
|
||||||
select count(*) n from twts `+where, args...).Scan(&end)
|
select count(*) n from twts `+where+``, args...).Scan(&end)
|
||||||
span.RecordError(err)
|
span.RecordError(err)
|
||||||
|
|
||||||
if offset < 1 {
|
if offset < 1 {
|
||||||
@ -162,9 +162,9 @@ func httpServer(ctx context.Context, app *appState) error {
|
|||||||
coalesce(uri, 'https://empty.txt') uri,
|
coalesce(uri, 'https://empty.txt') uri,
|
||||||
text
|
text
|
||||||
FROM twts
|
FROM twts
|
||||||
left join (
|
join (
|
||||||
select feed_id, nick, uri
|
select feed_id, nick, uri
|
||||||
from feeds
|
from feeds
|
||||||
) using (feed_id)
|
) using (feed_id)
|
||||||
where rowid in (
|
where rowid in (
|
||||||
select rowid from twts
|
select rowid from twts
|
||||||
@ -174,7 +174,7 @@ func httpServer(ctx context.Context, app *appState) error {
|
|||||||
offset ?
|
offset ?
|
||||||
)
|
)
|
||||||
order by ulid asc`
|
order by ulid asc`
|
||||||
|
|
||||||
fmt.Println(qry, args)
|
fmt.Println(qry, args)
|
||||||
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
||||||
rows, err := db.QueryContext(
|
rows, err := db.QueryContext(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user