Skip to content

Commit

Permalink
style: fix typos (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorWinberg committed Jun 8, 2022
1 parent de0f4a6 commit 87bc9ad
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion aw-datastore/src/datastore.rs
Expand Up @@ -530,7 +530,7 @@ impl DatastoreInstance {
Ok(())
}

// TODO: Function for deleteing events by timerange with limit
// TODO: Function for deleting events by timerange with limit

fn update_endtime(&mut self, bucket: &mut Bucket, event: &Event) {
let mut update = false;
Expand Down
18 changes: 9 additions & 9 deletions aw-datastore/src/worker.rs
Expand Up @@ -39,7 +39,7 @@ impl fmt::Debug for Datastore {
* TODO:
* - Allow read requests to go straight through a read-only db connection instead of requesting the
* worker thread for better performance?
* TODO: Add an seperate "Import" request which does an import with an transaction
* TODO: Add an separate "Import" request which does an import with an transaction
*/

#[allow(clippy::large_enum_variant)]
Expand Down Expand Up @@ -99,7 +99,7 @@ struct DatastoreWorker {
responder: RequestReceiver,
legacy_import: bool,
quit: bool,
uncommited_events: usize,
uncommitted_events: usize,
commit: bool,
last_heartbeat: HashMap<String, Option<Event>>,
}
Expand All @@ -113,7 +113,7 @@ impl DatastoreWorker {
responder,
legacy_import,
quit: false,
uncommited_events: 0,
uncommitted_events: 0,
commit: false,
last_heartbeat: HashMap::new(),
}
Expand Down Expand Up @@ -165,7 +165,7 @@ impl DatastoreWorker {
};
tx.set_drop_behavior(DropBehavior::Commit);

self.uncommited_events = 0;
self.uncommitted_events = 0;
self.commit = false;
loop {
let (request, response_sender) = match self.responder.poll() {
Expand All @@ -188,15 +188,15 @@ impl DatastoreWorker {
let commit_interval_passed: bool = (now - last_commit_time) > Duration::seconds(15);
if self.commit
|| commit_interval_passed
|| self.uncommited_events > 100
|| self.uncommitted_events > 100
|| self.quit
{
break;
};
}
debug!(
"Commiting DB! Force commit {}, {} uncommited events",
self.commit, self.uncommited_events
"Committing DB! Force commit {}, {} uncommitted events",
self.commit, self.uncommitted_events
);
match tx.commit() {
Ok(_) => (),
Expand Down Expand Up @@ -238,7 +238,7 @@ impl DatastoreWorker {
Command::InsertEvents(bucketname, events) => {
match ds.insert_events(tx, &bucketname, events) {
Ok(events) => {
self.uncommited_events += events.len();
self.uncommitted_events += events.len();
self.last_heartbeat.insert(bucketname.to_string(), None); // invalidate last_heartbeat cache
Ok(Response::EventList(events))
}
Expand All @@ -248,7 +248,7 @@ impl DatastoreWorker {
Command::Heartbeat(bucketname, event, pulsetime) => {
match ds.heartbeat(tx, &bucketname, event, pulsetime, &mut self.last_heartbeat) {
Ok(e) => {
self.uncommited_events += 1;
self.uncommitted_events += 1;
Ok(Response::Event(e))
}
Err(e) => Err(e),
Expand Down
2 changes: 1 addition & 1 deletion aw-models/src/tryvec.rs
Expand Up @@ -106,7 +106,7 @@ where

// Format a message stating what data this Visitor expects to receive.
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
formatter.write_str("a seqence")
formatter.write_str("a sequence")
}

fn visit_seq<M>(self, mut access: M) -> Result<Self::Value, M::Error>
Expand Down
6 changes: 3 additions & 3 deletions aw-transform/src/flood.rs
Expand Up @@ -98,7 +98,7 @@ pub fn flood(events: Vec<Event>, pulsetime: chrono::Duration) -> Vec<Event> {
warned_negative_gap_safe = true;
}
let start = std::cmp::min(e1.timestamp, e2.timestamp);
let end = std::cmp::max(e1.calculate_endtime(), e2.calculate_endtime()); // e2 isn't guarranteed to end last
let end = std::cmp::max(e1.calculate_endtime(), e2.calculate_endtime()); // e2 isn't guaranteed to end last
e1.timestamp = start;
e1.duration = end - start;
// Drop next event since it is merged/flooded into e1
Expand Down Expand Up @@ -134,8 +134,8 @@ pub fn flood(events: Vec<Event>, pulsetime: chrono::Duration) -> Vec<Event> {
// If data is the same, we should merge them.
if e1.data == e2.data {
// Choose the longest event and set the endtime to it
let start = std::cmp::min(e1.timestamp, e2.timestamp); // isn't e1 guarranteed to start?
let end = std::cmp::max(e1.calculate_endtime(), e2.calculate_endtime()); // e2 isn't guarranteed to end last
let start = std::cmp::min(e1.timestamp, e2.timestamp); // isn't e1 guaranteed to start?
let end = std::cmp::max(e1.calculate_endtime(), e2.calculate_endtime()); // e2 isn't guaranteed to end last
e1.timestamp = start;
e1.duration = end - start;
// Drop next event since it is merged/flooded into e1
Expand Down

0 comments on commit 87bc9ad

Please sign in to comment.