Skip to content

Commit

Permalink
Update flake and resolve warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
cofob committed Aug 31, 2024
1 parent 281e330 commit bc8826d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 29 deletions.
4 changes: 0 additions & 4 deletions fastside-actualizer/src/serde_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,6 @@ pub struct ServiceHistory {
const MIN_UPTIME: u8 = 5;

impl ServiceHistory {
pub fn get_instance(&self, url: &Url) -> Option<&InstanceHistory> {
self.instances.iter().find(|i| &i.url == url)
}

pub fn get_instance_mut(&mut self, url: &Url) -> Option<&mut InstanceHistory> {
self.instances.iter_mut().find(|i| &i.url == url)
}
Expand Down
23 changes: 3 additions & 20 deletions fastside/src/crawler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,25 +91,18 @@ pub struct CrawledServices {
pub enum CrawledData {
CrawledServices(CrawledServices),
InitialLoading,
ReloadingServices {
current: CrawledServices,
new: Option<CrawledServices>,
},
ReloadingServices(CrawledServices),
}

impl CrawledData {
pub fn get_services(&self) -> Option<&CrawledServices> {
match self {
Self::CrawledServices(s) => Some(s),
Self::InitialLoading => None,
Self::ReloadingServices { current, .. } => Some(current),
Self::ReloadingServices(current) => Some(current),
}
}

pub fn is_fetched(&self) -> bool {
self.get_services().is_some()
}

pub fn is_reloading(&self) -> bool {
matches!(self, Self::ReloadingServices { .. })
}
Expand All @@ -123,17 +116,7 @@ impl CrawledData {
Self::CrawledServices(s) => s.clone(),
_ => return,
};
*self = Self::ReloadingServices { current, new: None };
}

pub fn make_reloaded(&mut self) {
let new = match self {
Self::ReloadingServices { new, .. } => new.take(),
_ => return,
};
if let Some(new) = new {
*self = Self::CrawledServices(new);
}
*self = Self::ReloadingServices(current);
}
}

Expand Down
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
let
pkgs' = pkgs.extend (import (builtins.fetchTarball {
url =
"https://github.com/oxalica/rust-overlay/archive/9803f6e04ca37a2c072783e8297d2080f8d0e739.tar.gz";
sha256 = "1b566msx04y4s0hvwsza9gcv4djmni4fa6ik7q2m33b6x4vrb92w";
"https://github.com/oxalica/rust-overlay/archive/87b6cffc276795b46ef544d7ed8d7fed6ad9c8e4.tar.gz";
sha256 = "01gf3m4a0ljzkxf65lkcvr5kwcjr3mbpjbpppf0djk82mm98qbh4";
}));
in pkgs'.mkShell {
nativeBuildInputs = with pkgs'; [
Expand Down

0 comments on commit bc8826d

Please sign in to comment.