File tree Expand file tree Collapse file tree 3 files changed +29
-19
lines changed
examples/metadata-indexer/src Expand file tree Collapse file tree 3 files changed +29
-19
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " metadata-indexer " : patch
3+ ---
4+
5+ fix: handle insertion error when cast has no url embeds
Original file line number Diff line number Diff line change @@ -288,20 +288,30 @@ export class HubReplicator {
288288 index,
289289 } ) ) ;
290290
291- await this . db
292- . insertInto ( "castEmbedUrls" )
293- . values (
294- urls . map ( ( { url, normalizedUrl, index } ) => {
295- return {
296- castHash : castRow . hash ,
297- url : normalizedUrl , // Null values filtered above
298- unnormalizedUrl : url ,
299- index,
300- } ;
301- } )
302- )
303- . onConflict ( ( oc ) => oc . doNothing ( ) )
304- . execute ( ) ;
291+ if ( urls . length === 0 ) {
292+ continue ;
293+ }
294+
295+ const query = this . db . insertInto ( "castEmbedUrls" ) . values (
296+ urls . map ( ( { url, normalizedUrl, index } ) => {
297+ return {
298+ castHash : castRow . hash ,
299+ url : normalizedUrl ,
300+ unnormalizedUrl : url ,
301+ index,
302+ } ;
303+ } )
304+ ) ;
305+
306+ try {
307+ await query . onConflict ( ( oc ) => oc . doNothing ( ) ) . execute ( ) ;
308+ } catch ( error ) {
309+ this . log . error (
310+ `There was a problem processing cast with hash ${ castRow . hash . toString ( ) } `
311+ ) ;
312+ this . log . error ( error ) ;
313+ this . log . error ( query . compile ( ) . sql ) ;
314+ }
305315
306316 // this.log.info(
307317 // `[Sync] Indexed ${urls.length} URLs from cast ${bytesToHex(
Original file line number Diff line number Diff line change @@ -94,11 +94,6 @@ export class IndexerQueue {
9494 this . log . error (
9595 `[URL Indexer] Response not ok [${ response . status } ] ${ queryUrl } `
9696 ) ;
97- if ( response . status === 400 && retries === 0 ) {
98- // Retry 400 errors
99- this . log . info ( `[URL Indexer] Queueing retry for ${ url } ...` ) ;
100- this . indexQueue . push ( { url, retries : retries + 1 } ) ;
101- }
10297 return ;
10398 }
10499
You can’t perform that action at this time.
0 commit comments