keboola / settle
Settle provides a function to wait for something to happen.
Installs: 5 831
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 15
Forks: 0
Open Issues: 0
pkg:composer/keboola/settle
Requires
- php: >=7.4
- ext-json: *
- keboola/common-exceptions: ^1.1
- psr/log: ^1.1|^2.0|^3.0
- symfony/config: ^5.2|^6.2|^7.0
Requires (Dev)
- infection/infection: ^0.26
- keboola/coding-standard: >=14.0.0
- monolog/monolog: ^2.1
- phpstan/phpstan: ^1.9
- phpunit/phpunit: ^9.5
- sempro/phpunit-pretty-print: ^1.4
- symfony/dotenv: ^6.2|^7.0
- dev-main
- 1.0.2
- 1.0.1
- 1.0.0
- dev-AJDA-1052-ondra
- dev-ST-devin-1760626167-single-job-submission-optimization
- dev-devin/1760948558-query-api-client-pr-comments
- dev-devin/AJDA-1087-1760625607-consolidate-workspace-loads
- dev-erik-AJDA-1087-single-job
- dev-erik-AJDA-594-part2
- dev-miro-AJDA-1167
- dev-miro-AJDA-1167-2
- dev-pepa_PAT-64_podWatch
- dev-ujovlado-snowflake-size
- dev-zajca-event-grid
- dev-PST-2442-ondra
- dev-pepa_k8s_deployment
- dev-roman-pst-1710
This package is auto-updated.
Last update: 2025-10-20 11:03:09 UTC
README
Library which provides a function that waits for something to happen. Usage:
use Keboola\Settle\SettleFactory; use Psr\Log\NullLogger; $logger = new NullLogger(); $factory = new SettleFactory($logger); $settle = $factory->createSettle(maxAttempts: 10, maxAttemptsDelay: 1); $i = 0; $settle->settle( comparator: fn($v) => $v === 5, getCurrentValue: function() use (&$i) {while ($i < 5) {$i++; return $i;}}, );
The settle function expects two callbacks - comparator and getCurrentValue. In a typical scenario, the
getCurrentValue checks and returns the result of some asynchronous operation (data loaded, process finished) and
the comparator checks that the getCurrentValue result is the expected value. If the expected value is not
reached within the specified number of attempts a RuntimeException is thrown.
License
MIT licensed, see LICENSE file.