Skip to content

[vpn-policy-routing] Wish: Preserve ASN lookup output from bundled user scripts #128

Closed
@yitzhaq

Description

@yitzhaq

When you're testing rules, you may find yourself frequently reloading VPR until things work the way you want. If you happen to have one of the bundled user scripts enabled, this will cause repeated AS lookups against the third-party service, only to receive a result that with overwhelming likelihood is identical to the previous one. As seen in #125 there can also be other circumstances where VPR will run several times within a short timespan.

With the previous service used for Netflix, this would quite quickly lead to throttling (and thus failure) after just a handful of requests, but even if this should not be the case with the new service, it seems bad form to be asking for seldomly changing data very often, at worst bordering on abuse. You could temporarily disable the user script to prevent this, of course, but then you might forget to re-enable it, and this also wouldn't help in the cases where multiple reloads are triggered. Or if the user script is what you're testing.

Seems to me it would be better if the user script had a means to prevent the unnecessary repeated lookups. As a bonus, this would also mean you wouldn't need to wait for (possible) throttling to end before things start working again. It could perhaps also shave a few milliseconds off the run time (not a significant change, I would imagine), at the cost of not very dynamic data becoming marginally less dynamic.

What if, instead of rm-ing $TARGET_FNAME at the end, it was preserved across runs, and only got cURLed if it didn't exist or had an mtime of $DB_REFRESH_AGE (or some better name), with a default value of 24h? Not cleaning up this tiny file in tmp (until it happens organically anyway) seems an acceptable tradeoff to me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions