Skip to content

Commit 52189d0

Browse files
committed
Require priority group for app updates
1 parent 6853819 commit 52189d0

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

main.py

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,9 @@ def parse_arguments(self) -> argparse.Namespace:
109109
help="Number of workers to use for updating app store details",
110110
)
111111
parser.add_argument(
112-
"--country-crawl-priority-group",
113-
help="Country crawl priority group to use when updating app store details",
112+
"--country-priority-group",
113+
help="Country priority group to use when updating app store details",
114114
type=int,
115-
default=1,
116115
)
117116
parser.add_argument(
118117
"-a",
@@ -198,19 +197,16 @@ def check_app_update_processes(self) -> bool:
198197
if any([" -u " in x, " --update-app-store-details" in x])
199198
]
200199

201-
if self.args.country_crawl_priority_group:
202-
found_processes = [
203-
x
204-
for x in found_processes
205-
if any(
206-
[
207-
f"--country-crawl-priority-group={self.args.country_crawl_priority_group}"
208-
in x,
209-
f"--country-crawl-priority-group {self.args.country_crawl_priority_group}"
210-
in x,
211-
]
212-
)
213-
]
200+
found_processes = [
201+
x
202+
for x in found_processes
203+
if any(
204+
[
205+
f"--country-priority-group={self.args.country_priority_group}" in x,
206+
f"--country-priority-group {self.args.country_priority_group}" in x,
207+
]
208+
)
209+
]
214210

215211
if self.args.platform:
216212
found_processes = [x for x in found_processes if self.args.platform in x]
@@ -296,7 +292,7 @@ def main(self) -> None:
296292
self.scrape_new_apps_devs(store)
297293

298294
if self.args.update_app_store_details:
299-
self.update_app_details(store)
295+
self.update_app_details(store, self.args.country_priority_group)
300296

301297
if self.args.app_ads_txt_scrape:
302298
self.crawl_app_ads()
@@ -367,14 +363,19 @@ def scrape_new_apps_devs(self, store: int) -> None:
367363
except Exception:
368364
logger.exception(f"Crawling developers for {store=} failed")
369365

370-
def update_app_details(self, store: int) -> None:
366+
def update_app_details(self, store: int, country_priority_group: int) -> None:
367+
if not country_priority_group:
368+
logger.error(
369+
"No country priority group provided, ie country-priority-group=1"
370+
)
371+
return
371372
update_app_details(
372373
store=store,
373374
database_connection=self.pgcon,
374375
use_ssh_tunnel=self.args.use_ssh_tunnel,
375376
workers=int(self.args.workers),
376377
process_icon=self.args.process_icons,
377-
country_crawl_priority=self.args.country_crawl_priority_group,
378+
country_crawl_priority=self.args.country_priority_group,
378379
limit=self.args.limit_query_rows,
379380
)
380381

0 commit comments

Comments
 (0)