public inbox for [email protected]
 help / color / mirror / Atom feed
From: Ammar Faizi <[email protected]>
To: Alviro Iskandar Setiawan <[email protected]>
Cc: GNU/Weeb Mailing List <[email protected]>
Subject: Re: [PATCH] generic scraper: add chat scraper
Date: Fri, 13 Aug 2021 23:45:56 +0700	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

Hi Alviro,

Thank you for your contribution to GNU/Weeb project, here is my code
review for your patch. Please address my request and I will merge your
patch to the main repo. I only see one problem with your patch.

> -static void run_scraper(Scraper *s, Main *main, DB *db)
> +void Scraper::runScrapers(void)
>  {
> -	auto st = db->prepare("SELECT eeee;");
> -	st->execute();
> -	if (auto row = st->fetch()) {
> -		int ft;
> -		char buffer[64];
> -		auto stmt = st->getStmt();
> -		size_t len = sizeof(buffer);
> -
> -		ft = mysqlx_get_bytes(row, 0, 0, buffer, &len);
> -		mysql_fetch_chk(ft, stmt);
> -		pr_notice("buf = %s (len = %zu)", buffer, len);
> -	}
> -	sleep(1);
> +	// auto st = db->prepare("SELECT eeee;");
> +	// st->execute();
> +	// if (auto row = st->fetch()) {
> +	// 	int ft;
> +	// 	char buffer[64];
> +	// 	auto stmt = st->getStmt();
> +	// 	size_t len = sizeof(buffer);
> +
> +	// 	ft = mysqlx_get_bytes(row, 0, 0, buffer, &len);
> +	// 	mysql_fetch_chk(ft, stmt);
> +	// 	pr_notice("buf = %s (len = %zu)", buffer, len);
> +	// }
> +	// sleep(1);
> +
> +	chatScraper_ = new tgvisd::Scrapers::ChatScraper(this);
> +
> +	std::thread chatScraper([this]{
> +		this->chatScraper_->run();
> +	});
> +	chatScraper.join();
>  }

Don't plug runScrapers() inside the class Scraper, this can be inlined
inside Scraper::run(). So please use static function without class.

Just that, the rest is fine to me.

Regards,
Ammar
-- 
GWML mailing list
[email protected]
https://gwml.gnuweeb.org/listinfo/gwml

  reply	other threads:[~2021-08-13 16:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-13 14:37 [PATCH] generic scraper: add chat scraper Alviro Iskandar Setiawan
2021-08-13 14:37 ` Alviro Iskandar Setiawan
2021-08-13 16:45   ` Ammar Faizi [this message]
2021-08-14  6:40     ` [PATCH] Scraper: don't make runScrapers() be class method Alviro Iskandar Setiawan
2021-08-14  6:40       ` Alviro Iskandar Setiawan
2021-08-14  7:01         ` Ammar Faizi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox