-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for lock expiry. #12
Open
fabianfreyer
wants to merge
1
commit into
open-lms-open-source:master
Choose a base branch
from
fabianfreyer:lock_expiry
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Discussed-with: Nils Adermann <[email protected]>
naderman
approved these changes
Jan 22, 2021
dvdcastro
suggested changes
Feb 4, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unit tests are failing locally for me, please review them.
vendor/bin/phpunit local/redislock/tests/redis_lock_factory_test.php
Testing started at 3:49 PM ...
Moodle 3.9.3 (Build: 20201109), ab5949dbe283a074834710b28cf17a298c54a786
Php: 7.2.24.0.0.18.04.6, mysqli: 5.7.30-0ubuntu0.18.04.1, OS: Linux 4.15.0-101-generic x86_64
PHPUnit 7.5.20 by Sebastian Bergmann and contributors.
Failed asserting that 86400 matches expected -1.
Expected :-1
Actual :86400
<Click to see difference>
/vagrant/www/moodle/local/redislock/tests/redis_lock_factory_test.php:76
/vagrant/www/moodle/lib/phpunit/classes/advanced_testcase.php:91
Failed asserting that a boolean is not empty.
/vagrant/www/moodle/local/redislock/tests/redis_lock_factory_test.php:134
/vagrant/www/moodle/lib/phpunit/classes/advanced_testcase.php:91
Failed asserting that a boolean is not empty.
/vagrant/www/moodle/local/redislock/tests/redis_lock_factory_test.php:156
/vagrant/www/moodle/lib/phpunit/classes/advanced_testcase.php:91
Expectation failed for method name is equal to 'setnx' when invoked at least once.
Expected invocation at least once but it never occurred.
/vagrant/www/moodle/lib/phpunit/classes/advanced_testcase.php:91
Expectation failed for method name is equal to 'setnx' when invoked 1 time(s).
Method was expected to be called 1 times, actually called 0 times.
/vagrant/www/moodle/lib/phpunit/classes/advanced_testcase.php:91
Time: 30.98 seconds, Memory: 128.50 MB
FAILURES!
Tests: 6, Assertions: 17, Failures: 5.
Fatal error: Uncaught coding_exception: Coding error detected, it must be fixed by a programmer: A lock was created but not released at:
/vagrant/www/moodle/local/redislock/tests/redis_lock_factory_test.php on line 74
Code should look like:
$factory = \core\lock\lock_config::get_lock_factory('type');
$lock = $factory->get_lock(master372a_core_cron_test);
$lock->release(); // Locks must ALWAYS be released like this.
in /vagrant/www/moodle/lib/classes/lock/lock.php on line 117
Call Stack:
0.0004 391544 1. {main}() /vagrant/www/moodle/vendor/phpunit/phpunit/phpunit:0
0.0262 1159232 2. PHPUnit\TextUI\Command::main() /vagrant/www/moodle/vendor/phpunit/phpunit/phpunit:61
0.0262 1159344 3. PHPUnit\TextUI\Command->run() /vagrant/www/moodle/vendor/phpunit/phpunit/src/TextUI/Command.php:162
5.2651 130201720 4. PHPUnit\TextUI\TestRunner->doRun() /vagrant/www/moodle/vendor/phpunit/phpunit/src/TextUI/Command.php:206
coding_exception: Coding error detected, it must be fixed by a programmer: A lock was created but not released at:
/vagrant/www/moodle/local/redislock/tests/redis_lock_factory_test.php on line 74
Code should look like:
$factory = \core\lock\lock_config::get_lock_factory('type');
$lock = $factory->get_lock(master372a_core_cron_test);
$lock->release(); // Locks must ALWAYS be released like this.
in /vagrant/www/moodle/lib/classes/lock/lock.php on line 117
Call Stack:
0.0004 391544 1. {main}() /vagrant/www/moodle/vendor/phpunit/phpunit/phpunit:0
0.0262 1159232 2. PHPUnit\TextUI\Command::main() /vagrant/www/moodle/vendor/phpunit/phpunit/phpunit:61
0.0262 1159344 3. PHPUnit\TextUI\Command->run() /vagrant/www/moodle/vendor/phpunit/phpunit/src/TextUI/Command.php:162
5.2651 130201720 4. PHPUnit\TextUI\TestRunner->doRun() /vagrant/www/moodle/vendor/phpunit/phpunit/src/TextUI/Command.php:206
30.9895 132674296 5. core\lock\lock->__destruct() /vagrant/www/moodle/lib/classes/lock/lock.php:0
Process finished with exit code 1
mr-www-admin
force-pushed
the
master
branch
6 times, most recently
from
May 9, 2022 15:58
44096df
to
d03db82
Compare
mr-www-admin
force-pushed
the
master
branch
5 times, most recently
from
August 11, 2022 19:40
80d70a2
to
101a6fa
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
cc @naderman