projects
/
brackets.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d7efcbb
)
Short circuit if artist is known
author
Jacob Casper
<dev@jacobcasper.com>
Fri, 17 Apr 2020 01:33:13 +0000
(20:33 -0500)
committer
Jacob Casper
<dev@jacobcasper.com>
Fri, 17 Apr 2020 01:51:58 +0000
(20:51 -0500)
scrape/graph/graph.go
patch
|
blob
|
blame
|
history
diff --git
a/scrape/graph/graph.go
b/scrape/graph/graph.go
index
7a31924
..
fe150b7
100644
(file)
--- a/
scrape/graph/graph.go
+++ b/
scrape/graph/graph.go
@@
-43,6
+43,22
@@
WHERE ID NOT IN (
success := true
postArtists:
for _, artist := range artists {
+ row := env.Db.Db.QueryRow(`
+SELECT EXISTS (
+ SELECT 1
+ FROM ARTIST
+ WHERE ID = ?
+)
+`,
+ artist.ID)
+ var exists bool
+ if err := row.Scan(&exists); err != nil {
+ // We don't care, this was a short circuit check
+ }
+ if exists {
+ continue postArtists
+ }
+
resp, err := http.PostForm("http://localhost:8080/artist/add", url.Values{"id": {string(artist.ID)}})
if err != nil {
log.Print(err)