Skip to content

Use mixins with AbstractProvider path to race conditioning for youre provider #429

@therb1

Description

@therb1

When super().__init__() is executed, the __init__ function in all mixins is executed.
Just because there is no __init__ function in AbstractProvider, the __init__ function of all subsequent mixins is not executed.

To work around the problem, you need to put AbstractProvider at the end of the list, after all mixins.

Do you plan to do something about this?
You can add __init__ to AbstractProvider, but I'm not sure if this is the right solution.

Here is an example of how I got this problem

from openfeature.provider.provider import AbstractProvider
from openfeature import api
from src.python_sdk_provider.mixins import ClientMixin
from src.python_sdk_provider.mixins import ParameterEventsMixin
from src.python_sdk_provider.mixins import FlagResolutionMixin
from src.python_sdk_provider.mixins import UpdateMixin
from src.python_sdk_provider.mixins import LogsMixin
from src.python_sdk_provider.mixins import MetricsMixin

class Provider(
    ClientMixin,
    ParameterEventsMixin,
    FlagResolutionMixin,
    UpdateMixin,
    AbstractProvider, <-- here's a problem
    MetricsMixin, <-- Dont execute def __init__
    LogsMixin, <-- Dont execute def __init__
):
    def __init__(self):
        super().__init__()
        self.openfeature_backend_url = ""
_...more code..._

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions