Skip to content

Improve raw_measurement API call #1150

Description

@hellais

In the raw_measurement calls and I think there is an opportunity for optimizing it a bit.

Specifically I am seeing that https://github.com/ooni/backend/blob/master/ooniapi/services/oonimeasurements/src/oonimeasurements/routers/v1/measurements.py#L77 doesn't explicitly close the file descriptors operating on the files so in theory there could be some FD leak happening and/or lead to them not getting cleaned up by the garbage collector deterministically.

This task is about refactoring it using contextlib import closing for the urlopen fd and making use of the context manager for GZip too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions