@@ -164,9 +164,10 @@ func PageRenderAndUpload(v1 *viper.Viper, mc *minio.Client, timeout time.Duratio
164
164
165
165
jsonlds , err := PageRender (v1 , timeout , url , k , repologger , repoStats )
166
166
167
- if err != nil { // from page render
167
+ if err == nil { // from page render. If there are no errros, upload.
168
168
if len (jsonlds ) > 1 {
169
- repologger .WithFields (log.Fields {"url" : url , "issue" : "Multiple JSON" }).Debug (err )
169
+ log .WithFields (log.Fields {"url" : url , "issue" : "Multiple JSON" }).Info ("Error uploading jsonld to object store:" , url )
170
+ repologger .WithFields (log.Fields {"url" : url , "issue" : "Multiple JSON" }).Debug ()
170
171
}
171
172
for _ , jsonld := range jsonlds {
172
173
sha , err := Upload (v1 , mc , bucketName , k , url , jsonld )
@@ -175,6 +176,7 @@ func PageRenderAndUpload(v1 *viper.Viper, mc *minio.Client, timeout time.Duratio
175
176
repologger .WithFields (log.Fields {"url" : url , "sha" : sha , "issue" : "Error uploading jsonld to object store" }).Error (err )
176
177
repoStats .Inc (common .StoreError )
177
178
} else {
179
+ log .WithFields (log.Fields {"url" : url , "sha" : sha , "issue" : "Uploaded JSONLD to object store" }).Info ("Uploaded JSONLD to object store:" , url , err , sha )
178
180
repologger .WithFields (log.Fields {"url" : url , "sha" : sha , "issue" : "Uploaded JSONLD to object store" }).Debug ()
179
181
repoStats .Inc (common .Stored )
180
182
}
@@ -198,6 +200,7 @@ func PageRender(v1 *viper.Viper, timeout time.Duration, url, k string, repologge
198
200
sources , err := configTypes .GetSources (v1 )
199
201
source , err := configTypes .GetSourceByName (sources , k )
200
202
headlessWait := source .HeadlessWait
203
+
201
204
if timeout * time .Duration (retries ) < time .Duration (headlessWait )* time .Second {
202
205
timeout = time .Duration (headlessWait ) * time .Second
203
206
}
@@ -389,24 +392,8 @@ func PageRender(v1 *viper.Viper, timeout time.Duration, url, k string, repologge
389
392
} else if valid && jsonld != "" { // traps out the root domain... should do this different
390
393
response = append (response , jsonld )
391
394
err = nil
392
- //sha, err := Upload(v1, mc, bucketName, k, url, jsonld)
393
- //if err != nil {
394
- // log.WithFields(log.Fields{"url": url, "sha": sha, "issue": "Error uploading jsonld to object store"}).Error("Error uploading jsonld to object store:", url, err, sha)
395
- // repologger.WithFields(log.Fields{"url": url, "sha": sha, "issue": "Error uploading jsonld to object store"}).Error(err)
396
- // repoStats.Inc(common.StoreError)
397
- //} else {
398
- // repologger.WithFields(log.Fields{"url": url, "sha": sha, "issue": "Uploaded JSONLD to object store"}).Debug()
399
- // repoStats.Inc(common.Stored)
400
- //}
401
- //// TODO Is here where to add an entry to the KV store
402
- //err = db.Update(func(tx *bolt.Tx) error {
403
- // b := tx.Bucket([]byte(k))
404
- // err := b.Put([]byte(url), []byte(sha))
405
- // if err != nil {
406
- // log.Error("Error writing to bolt", err)
407
- // }
408
- // return nil
409
- //})
395
+ // need to just return a list
396
+
410
397
} else {
411
398
// there could be one bad jsonld, and one good. We want to process the jsonld
412
399
// so, do not set an err
0 commit comments