File tree Expand file tree Collapse file tree
BackgroundProcessor/Processors Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,14 +31,25 @@ public async Task Process(CancellationToken cancellationToken)
3131
3232 await foreach ( var redditPostId in query )
3333 {
34- if ( ! ( await _submissionBrowser . GetSubmission ( LinkThing . CreateFromShortId ( redditPostId ) ) ) . Try ( out var submission ) )
34+ try
3535 {
36+ var submissionResult = await _submissionBrowser . GetSubmission ( LinkThing . CreateFromShortId ( redditPostId ) ) ;
37+
38+ if ( ! submissionResult . Try ( out var submission ) )
39+ {
40+ await _redditPostProvider . SetTitleFetchedForPostId ( redditPostId , cancellationToken ) ;
41+ _logger . LogInformation ( "Submission title couldn't be fetched for {RedditPostId} because the submission has been removed" , redditPostId ) ;
42+ return ;
43+ }
44+
45+ await _redditPostProvider . SetPostTitle ( redditPostId , submission . Title , cancellationToken ) ;
46+ }
47+ catch ( Exception ex )
48+ {
49+ // We'll figure out how to clean these up later
50+ _logger . LogError ( ex , "Error fetching title for {RedditPostId}" , redditPostId ) ;
3651 await _redditPostProvider . SetTitleFetchedForPostId ( redditPostId , cancellationToken ) ;
37- _logger . LogInformation ( "Submission title couldn't be fetched for {RedditPostId} because the submission has been removed" , redditPostId ) ;
38- return ;
3952 }
40-
41- await _redditPostProvider . SetPostTitle ( redditPostId , submission . Title , cancellationToken ) ;
4253 }
4354 }
4455}
You can’t perform that action at this time.
0 commit comments