Skip to content

Commit

Permalink
Move seniority skip reasons to constant
Browse files Browse the repository at this point in the history
  • Loading branch information
bbalser committed Nov 4, 2024
1 parent b8f9ff7 commit edc4f53
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mobile_verifier/src/seniority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,12 @@ impl<'a> SeniorityUpdate<'a> {
) -> anyhow::Result<Self> {
use proto::SeniorityUpdateReason::*;

const SENIORITY_UPDATE_SKIP_REASONS: [i32; 2] =
[HeartbeatNotSeen as i32, ServiceProviderBan as i32];

if let Some(prev_seniority) = latest_seniority {
if heartbeat.heartbeat.coverage_object != Some(prev_seniority.uuid) {
if [HeartbeatNotSeen as i32, ServiceProviderBan as i32]
.contains(&prev_seniority.update_reason)
if SENIORITY_UPDATE_SKIP_REASONS.contains(&prev_seniority.update_reason)
&& coverage_claim_time < prev_seniority.seniority_ts
{
Self::from_heartbeat(heartbeat, SeniorityUpdateAction::NoAction)
Expand Down

0 comments on commit edc4f53

Please sign in to comment.