File tree Expand file tree Collapse file tree 6 files changed +27
-7
lines changed
migrations/2024-04-12-205749_fix_revision_index Expand file tree Collapse file tree 6 files changed +27
-7
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,8 @@ members = [
44 " parse-rfd" ,
55 " rfd-api" ,
66 " rfd-cli" ,
7- " rfd-data" , " rfd-github" ,
7+ " rfd-data" ,
8+ " rfd-github" ,
89 " rfd-model" ,
910 " rfd-processor" ,
1011 " rfd-redirect" ,
Original file line number Diff line number Diff line change @@ -779,7 +779,7 @@ impl ApiContext {
779779 }
780780 }
781781
782- #[ instrument( skip( self , caller) ) ]
782+ #[ instrument( skip( self , caller, content ) ) ]
783783 pub async fn update_rfd_content (
784784 & self ,
785785 caller : & ApiCaller ,
@@ -816,13 +816,20 @@ impl ApiContext {
816816 let sha = latest_revision. commit_sha ;
817817 let mut github_locations = self
818818 . github
819- . locations_for_commit ( sha)
819+ . locations_for_commit ( sha. clone ( ) )
820820 . await
821821 . map_err ( UpdateRfdContentError :: GitHub )
822822 . to_resource_result ( ) ?;
823823
824824 match github_locations. len ( ) {
825- 0 => Err ( ResourceError :: DoesNotExist ) ,
825+ 0 => {
826+ tracing:: warn!(
827+ sha,
828+ rfd_number,
829+ "Failed to find a GitHub location for most recent revision"
830+ ) ;
831+ Err ( ResourceError :: DoesNotExist )
832+ }
826833 1 => {
827834 // Unwrap is checked by the location length
828835 let location = github_locations. pop ( ) . unwrap ( ) ;
Original file line number Diff line number Diff line change 1+ DROP INDEX rfd_revision_commit_sha_idx;
2+ CREATE UNIQUE INDEX rfd_revision_sha_idx ON rfd_revision (rfd_id, sha);
Original file line number Diff line number Diff line change 1+ -- Your SQL goes here
Original file line number Diff line number Diff line change @@ -274,7 +274,10 @@ impl RfdRevisionStore for PostgresStore {
274274 let query = query
275275 . offset ( pagination. offset )
276276 . limit ( pagination. limit )
277- . order ( ( rfd_revision:: rfd_id. asc ( ) , rfd_revision:: created_at. desc ( ) ) ) ;
277+ . order ( (
278+ rfd_revision:: rfd_id. asc ( ) ,
279+ rfd_revision:: committed_at. desc ( ) ,
280+ ) ) ;
278281
279282 let results = query
280283 . get_results_async :: < RfdRevisionModel > ( & * self . pool . get ( ) . await ?)
Original file line number Diff line number Diff line change @@ -362,8 +362,14 @@ impl RemoteRfd {
362362 . await ?
363363 . into_iter ( )
364364 . next ( )
365- . map ( |revision| revision. id )
366- . unwrap_or_else ( || Uuid :: new_v4 ( ) ) ;
365+ . map ( |revision| {
366+ tracing:: info!( "Found existing RFD revision for this commit. Updating the revision." ) ;
367+ revision. id
368+ } )
369+ . unwrap_or_else ( || {
370+ tracing:: info!( "No existing revisions exist for this commit. Creating a new revision." ) ;
371+ Uuid :: new_v4 ( )
372+ } ) ;
367373
368374 let revision = RfdRevisionStore :: upsert (
369375 storage,
You can’t perform that action at this time.
0 commit comments