Skip to content
This repository has been archived by the owner on Jul 22, 2022. It is now read-only.

Commit

Permalink
fix(indexer): return correct checkpoint json
Browse files Browse the repository at this point in the history
Fixes #1
  • Loading branch information
stoically committed Feb 16, 2020
1 parent 5e00514 commit ec04640
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion native/src/indexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,20 @@ impl Indexer {

fn load_checkpoints(&mut self) -> Result<Value, Error> {
let checkpoints = self.connection.load_checkpoints()?;
Ok(serde_json::to_value(&checkpoints)?)
let mut checkpoints_json = Vec::new();
for checkpoint in checkpoints {
let direction = match checkpoint.direction {
CheckpointDirection::Backwards => "b",
CheckpointDirection::Forwards => "f",
};
checkpoints_json.push(json!({
"roomId": checkpoint.room_id,
"token": checkpoint.token,
"fullCrawl": checkpoint.full_crawl,
"direction": direction,
}));
}
Ok(serde_json::to_value(&checkpoints_json)?)
}

fn is_event_index_empty(&mut self) -> Result<Value, Error> {
Expand Down

0 comments on commit ec04640

Please sign in to comment.