mirror of
https://github.com/davegallant/rfd-notify.git
synced 2025-08-07 09:02:28 +00:00
Add optional --dbpath flag (#6)
* Use common config with lower cache capacity * Add command line argument parser * Add optional --dbpath flag
This commit is contained in:
@@ -73,7 +73,7 @@ fn hash_deal(topic: &Topic) -> String {
|
||||
hasher.result_str()
|
||||
}
|
||||
|
||||
pub fn match_deals(deals: Deals, config: Config) {
|
||||
pub fn match_deals(deals: Deals, config: Config, dbpath: &str) {
|
||||
for topic in deals.topics.iter() {
|
||||
for expression in config.expressions.iter() {
|
||||
let mut found_match = false;
|
||||
@@ -101,7 +101,7 @@ pub fn match_deals(deals: Deals, config: Config) {
|
||||
continue;
|
||||
}
|
||||
let deal_hash = hash_deal(topic);
|
||||
if db::hash_exists(&deal_hash) {
|
||||
if db::hash_exists(&deal_hash, db::get_config(dbpath)) {
|
||||
debug!("deal hash '{}' already exists", &deal_hash);
|
||||
} else {
|
||||
let posts = parse_posts(
|
||||
@@ -110,7 +110,7 @@ pub fn match_deals(deals: Deals, config: Config) {
|
||||
.ok()
|
||||
.unwrap(),
|
||||
);
|
||||
db::insert(&deal_hash);
|
||||
db::insert(&deal_hash, db::get_config(dbpath));
|
||||
mail::send(topic, &posts, expression, &config);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user