Skip to content

Commit

Permalink
Merge pull request #22 from wojnilowicz/bump-aw-server-rust
Browse files Browse the repository at this point in the history
  • Loading branch information
2e3s committed Jun 11, 2024
2 parents 13cea8b + 8597254 commit cfb3ad8
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ extern crate log;
mod bundle;
mod config;

use std::error::Error;
use std::sync::Arc;
use tokio::signal::unix::{signal, SignalKind};
#[cfg(feature = "bundle")]
use tokio::sync::mpsc;
use watchers::{run_first_supported, ReportClient, WatcherType};

#[tokio::main(flavor = "current_thread")]
async fn main() -> anyhow::Result<()> {
async fn main() -> anyhow::Result<(), Box<dyn Error>> {
let config = config::from_cli()?;
#[cfg(feature = "bundle")]
let no_tray = config.no_tray;
Expand Down
2 changes: 1 addition & 1 deletion watchers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ rstest = "0.19.0"
tempfile = "3.10.1"

[dependencies]
aw-client-rust = { git = "https://github.com/ActivityWatch/aw-server-rust", rev = "448312d" }
aw-client-rust = { git = "https://github.com/ActivityWatch/aw-server-rust", rev = "9275009" }
wayland-client = "0.31.1"
wayland-protocols = { version = "0.31.2", features = ["staging", "client" ]}
wayland-protocols-plasma = { version = "0.2.0", features = ["client"] }
Expand Down
2 changes: 1 addition & 1 deletion watchers/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub use file_config::FileConfig;
use std::time::Duration;

pub struct Config {
pub port: u32,
pub port: u16,
pub host: String,
pub idle_timeout: Duration,
pub poll_time_idle: Duration,
Expand Down
2 changes: 1 addition & 1 deletion watchers/src/config/defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub fn poll_time_idle_seconds() -> u32 {
pub fn poll_time_window_seconds() -> u32 {
1
}
pub fn port() -> u32 {
pub fn port() -> u16 {
5600
}
pub fn host() -> String {
Expand Down
2 changes: 1 addition & 1 deletion watchers/src/config/file_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub fn default_config() -> String {
#[derive(Deserialize, DefaultFromSerde)]
pub struct ServerConfig {
#[serde(default = "defaults::port")]
pub port: u32,
pub port: u16,
#[serde(default = "defaults::host")]
pub host: String,
}
Expand Down
5 changes: 3 additions & 2 deletions watchers/src/report_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use aw_client_rust::{AwClient, Event as AwEvent};
use chrono::{DateTime, Duration, Utc};
use serde_json::{Map, Value};
use std::future::Future;
use std::error::Error;

pub struct ReportClient {
pub client: AwClient,
Expand All @@ -13,8 +14,8 @@ pub struct ReportClient {
}

impl ReportClient {
pub async fn new(config: Config) -> anyhow::Result<Self> {
let client = AwClient::new(&config.host, &config.port.to_string(), "awatcher");
pub async fn new(config: Config) -> anyhow::Result<Self, Box<dyn Error>> {
let client = AwClient::new(&config.host, config.port, "awatcher")?;

let hostname = gethostname::gethostname().into_string().unwrap();
let idle_bucket_name = format!("aw-watcher-afk_{hostname}");
Expand Down

0 comments on commit cfb3ad8

Please sign in to comment.