Skip to content

enableLocalEvaluation can only be enabled if withEnvironmentTtl is specified in the consturctor #101

@predrag-nikolic-kombinat-dev

Description

Based on the docs:

    /*
    Set environment refresh rate with polling manager.
    This also enables local evaluation.
    Optional.
    Defaults to null
    */
    int $environmentTtl = null,

enableLocalEvaluation will only be enabled if I provide environmentTtl through the constructor new Flagsmith("KEY", null, null, 100) ,
but not when you do (new Flagsmith("KEY"))->withEnvironmentTtl(100)... because $this->enableLocalEvaluation is only set in the constructor.

class Flagsmith
{
    public function __construct(
        string $apiKey = null,
        string $host = null,
        object $customHeaders = null,
        int $environmentTtl = null,
        ...
    ) {
       $this->enableLocalEvaluation = !is_null($environmentTtl);

I do expect that the current API withEnvironmentTtl set enableLocalEvaluation to true.


But ideally other flagsmith clients do have a more explict API, for example, the Java client has .withLocalEvaluation(true), python has enable_local_evaluation , JavaScript has enableLocalEvaluation.

Metadata

Metadata

Assignees

No one assigned

    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