Minoru / minoru-fediverse-crawler

Crawls the Fediverse and produces a list of instances that are alive
https://nodes.fediverse.party
GNU Affero General Public License v3.0
17 stars 3 forks source link

Replace chrono with std::time #295

Closed Salanoid closed 2 months ago

Salanoid commented 3 months ago

This commit replaces chrono::Duration with std::time::Duration. Fix for issue: #294

Minoru commented 3 months ago

Sadly there are no end-to-end tests in this project, so you'll have to rely on carefulness in order to preserve the current behaviour.

There are a few unit tests, and a couple CI jobs; these should be green.

Salanoid commented 3 months ago

Hi, I will reopen this pull request once I have finished the commits. Thank you so much for your feedback.

Salanoid commented 3 months ago

I made an intermediate commit; I still kept chrono so that the return types remains DateTime, and I think like this everything should work like before. To completely remove chrono, we need to adapt the other places where chrono is used, as you mentioned at the beginning.

Salanoid commented 2 months ago

The algorithm looks correct to me 👍 But the code fails to build (small error with the Result type). While you're at it, can you please also run cargo fmt?

I did that too, but i think the error from cargo build was because of my mistakes in here: time.rs line ~56 return type for now_plus_offset_plus_random_from_range

) -> Result<SystemTime> {
) -> anyhow::Result<SystemTime> {
Minoru commented 2 months ago

Excellent work, thank you very much for this! :tada: