Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tori)!: add support for beta.tori.fi #40

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

lajp
Copy link
Member

@lajp lajp commented Mar 31, 2024

This will bump the version to 0.3.0.
We are dropping support for:

  • Seller blacklist on tori.fi vahtis
  • Old tori.fi vahtis (users will have to create new ones)

Some things I'd still like to address in this PR:

  • Better shutdown handling with channels
  • Refine messages now that sellers no longer exist for tori.fi
  • Write tests for new api
  • Ensure nothing breaks

@lajp lajp added the critical label Mar 31, 2024
@lajp lajp self-assigned this Mar 31, 2024
@lajp lajp linked an issue Mar 31, 2024 that may be closed by this pull request
After the new Tori.fi update, there is no way to uniquely identify
the seller of an ad. I've decided to get rid of the seller
blacklist feature all together, despite it still being possible for
Huuto.net ads.

This is an unfortunate design choice on Tori.fi's part
and in my personal opinion the complete opposite of what should've been
done.
@lajp lajp marked this pull request as ready for review June 8, 2024 11:53
@lajp lajp requested a review from DrVilepis as a code owner June 8, 2024 11:53
@lajp lajp requested a review from luciusmagn June 8, 2024 11:54
src/database.rs Show resolved Hide resolved
src/delivery/discord.rs Show resolved Hide resolved
src/itemhistory.rs Show resolved Hide resolved
@@ -25,14 +28,16 @@ extern crate tracing;
#[macro_use]
extern crate diesel;

use std::sync::{Arc, LazyLock, RwLock};
use std::sync::{Arc, LazyLock};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use parking_lot, it will make everything nicer since they can never panic

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they are also faster and smaller in memory (but require that the platform you are deploying to can park threads)

src/main.rs Show resolved Hide resolved
src/tori/models.rs Show resolved Hide resolved
#[derive(Deserialize, Debug, Clone)]
pub struct ToriItem {
/// Type of the item for Torimies always "bap"
//pub r#type: String,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prolly get rid of this, if its unused.

If it is, it is much better to use #[serde(rename = "type")] and name the field something less keywordy

None
}
let ret = api_parse_after(&res, self.last_updated)
.unwrap()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unwrap? :(

}
#[cfg(feature = "tori")]
{
if site_id == crate::tori::ID {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.get(&k)
.expect("bug: impossible")
.lock()
.unwrap()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, you could avoid this with parking lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: support new beta.tori.fi urls
2 participants