1
- use super :: { QueueItem , QueueItemKind } ;
1
+ use super :: QueueItem ;
2
2
3
3
use crate :: rla;
4
4
use crate :: rla:: ci:: { self , BuildCommit , CiPlatform } ;
@@ -7,7 +7,7 @@ use rla::index::IndexStorage;
7
7
use std:: collections:: { HashSet , VecDeque } ;
8
8
use std:: hash:: Hash ;
9
9
use std:: str;
10
- use std:: time:: { Instant , Duration } ;
10
+ use std:: time:: { Duration , Instant } ;
11
11
12
12
const MINIMUM_DELAY_BETWEEN_INDEX_BACKUPS : Duration = Duration :: from_secs ( 60 * 60 ) ;
13
13
@@ -78,7 +78,7 @@ impl Worker {
78
78
let span = span ! (
79
79
tracing:: Level :: INFO ,
80
80
"request" ,
81
- delivery = item. delivery_id. as_str ( ) ,
81
+ delivery = item. delivery_id( ) ,
82
82
build_id = tracing:: field:: Empty
83
83
) ;
84
84
let _enter = span. enter ( ) ;
@@ -98,32 +98,38 @@ impl Worker {
98
98
}
99
99
100
100
fn process ( & mut self , item : QueueItem , span : & tracing:: Span ) -> rla:: Result < ( ) > {
101
- let ( repo, build_id, outcome) = match & item. kind {
102
- QueueItemKind :: GitHubStatus ( ev) => match self . ci . build_id_from_github_status ( & ev) {
103
- Some ( id) if self . is_repo_valid ( & ev. repository . full_name ) => {
104
- ( & ev. repository . full_name , id, None )
105
- }
106
- _ => {
107
- info ! (
108
- "Ignoring invalid event (ctx: {:?}, url: {:?})." ,
109
- ev. context, ev. target_url
110
- ) ;
111
- return Ok ( ( ) ) ;
112
- }
113
- } ,
114
- QueueItemKind :: GitHubCheckRun ( ev) => match self . ci . build_id_from_github_check ( & ev) {
115
- Some ( id) if self . is_repo_valid ( & ev. repository . full_name ) => {
116
- ( & ev. repository . full_name , id, Some ( & ev. check_run . outcome ) )
101
+ let ( repo, build_id, outcome) = match & item {
102
+ QueueItem :: GitHubStatus { payload, .. } => {
103
+ match self . ci . build_id_from_github_status ( & payload) {
104
+ Some ( id) if self . is_repo_valid ( & payload. repository . full_name ) => {
105
+ ( & payload. repository . full_name , id, None )
106
+ }
107
+ _ => {
108
+ info ! (
109
+ "Ignoring invalid event (ctx: {:?}, url: {:?})." ,
110
+ payload. context, payload. target_url
111
+ ) ;
112
+ return Ok ( ( ) ) ;
113
+ }
117
114
}
118
- _ => {
119
- info ! (
120
- "Ignoring invalid event (app id: {:?}, url: {:?})." ,
121
- ev. check_run. app. id, ev. check_run. details_url
122
- ) ;
123
- return Ok ( ( ) ) ;
115
+ }
116
+ QueueItem :: GitHubCheckRun { payload, .. } => {
117
+ match self . ci . build_id_from_github_check ( & payload) {
118
+ Some ( id) if self . is_repo_valid ( & payload. repository . full_name ) => (
119
+ & payload. repository . full_name ,
120
+ id,
121
+ Some ( & payload. check_run . outcome ) ,
122
+ ) ,
123
+ _ => {
124
+ info ! (
125
+ "Ignoring invalid event (app id: {:?}, url: {:?})." ,
126
+ payload. check_run. app. id, payload. check_run. details_url
127
+ ) ;
128
+ return Ok ( ( ) ) ;
129
+ }
124
130
}
125
- } ,
126
- QueueItemKind :: GitHubPullRequest ( ev ) => return self . process_pr ( ev ) ,
131
+ }
132
+ QueueItem :: GitHubPullRequest { payload , .. } => return self . process_pr ( payload ) ,
127
133
} ;
128
134
129
135
span. record ( "build_id" , & build_id) ;
0 commit comments