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

Fastpath: Add ooni_run_link_id support #768

Merged
merged 3 commits into from
Nov 29, 2023

Conversation

FedericoCeratto
Copy link
Contributor

Implements: #701
Specs: ooni/spec@220aaea

Copy link
Contributor

@bassosimone bassosimone left a comment

Choose a reason for hiding this comment

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

🐳

Copy link
Member

@hellais hellais left a comment

Choose a reason for hiding this comment

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

lgtm

@FedericoCeratto FedericoCeratto force-pushed the fastpath_ooni_run_link_id branch 2 times, most recently from 36ea57e to ef88df5 Compare November 15, 2023 14:56
@FedericoCeratto FedericoCeratto force-pushed the fastpath_ooni_run_link_id branch from 2962bb8 to 0cd0af3 Compare November 15, 2023 16:26
Comment on lines 1665 to 1672
ooni_run_link_id_str = g_or(annot, "ooni_run_link_id", "")
if ooni_run_link_id_str:
try:
ooni_run_link_id = int(ooni_run_link_id_str)
except ValueError:
ooni_run_link_id = None
else:
ooni_run_link_id = None
Copy link
Member

Choose a reason for hiding this comment

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

Isn't it a bit more clear to rewrite this as:

Suggested change
ooni_run_link_id_str = g_or(annot, "ooni_run_link_id", "")
if ooni_run_link_id_str:
try:
ooni_run_link_id = int(ooni_run_link_id_str)
except ValueError:
ooni_run_link_id = None
else:
ooni_run_link_id = None
ooni_run_link_id_str = g_or(annot, "ooni_run_link_id", None)
try:
ooni_run_link_id = int(ooni_run_link_id_str)
except (TypeError, ValueError):
ooni_run_link_id = None

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would be shorter but it would raise and catch an exception around int() even for the expected value "".

Copy link
Member

Choose a reason for hiding this comment

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

It would not raise the exception, since int("") throws a ValueError which is caught by the handler.

It's equivalent to the previous code.

Copy link
Member

@hellais hellais left a comment

Choose a reason for hiding this comment

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

Made small suggestion to the diff. Otherwise LGTM

@FedericoCeratto FedericoCeratto merged commit e7e0926 into master Nov 29, 2023
@FedericoCeratto FedericoCeratto deleted the fastpath_ooni_run_link_id branch November 29, 2023 13:56
@FedericoCeratto
Copy link
Contributor Author

0.84~pr768-221 deployed on -test

@FedericoCeratto
Copy link
Contributor Author

0.84~pr768-221 deployed on FSN

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

Successfully merging this pull request may close these issues.

3 participants