-
Notifications
You must be signed in to change notification settings - Fork 13
Description
Hello 👋
In the docs, the $environmentTtl
has the following documentation:
/*
Set environment refresh rate with polling manager.
This also enables local evaluation.
Optional.
Defaults to null
*/
int $environmentTtl = null,
So if I specify the $environmentTtl
with a value like 60
,
I expect php to ping the flagsmith /environment-document
API each 60 seconds.
But i don't think that flagsmith-php-client will pool the api each 60 seconds.
If we see the Local Evaluation Mode Network Behaviour documentation, we can see:
- When the SDK is initialised, it will make an asynchronous network request to retrieve details about the Environment.
- Every 60 seconds (by default), it will repeat this aysnchronous request to ensure that the > Environment information it has is up to date.
To achieve Local Evaluation, in most languages, the SDK spawns a separate thread (or equivalent) to poll the API for changes to the Environment. In certain languages, you may be required to terminate this thread before cleaning up the instance of the Flagsmith client. Languages in which this is necessary are provided below.
Question:
Will PHP spawn a separate thread and poll the flagsmith api with the given $environmentTtl
?
Additional info:
In the caching documentation section in PHP
we can see that states that an optional cron job can be added for polling. (I tought that the php-flagsmith-client was the one who was adding the cron job, not the dev)
An optional cron job can be added to refresh this cache at a set time depending on your choice. Please set EnvironmentTTL value for this purpose.
// the environment will be cached for 100 seconds.
$flagsmith = $flagsmith->withEnvironmentTtl(100);
$flagsmith->updateEnvironment();
* * * 1 40 php index.php # using cli
* * * 1 40 curl http://localhost:8000/ # using http
In any case, if pooling is not supported by the PHP client.
It would be good to remove the Set environment refresh rate with polling manager.
from the $environmentTtl