Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package perl-Mojo-Redis for openSUSE:Factory
checked in at 2021-11-27 00:51:41
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Mojo-Redis (Old)
and /work/SRC/openSUSE:Factory/.perl-Mojo-Redis.new.1895 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Mojo-Redis"
Sat Nov 27 00:51:41 2021 rev:6 rq:934056 version:3.27
Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Mojo-Redis/perl-Mojo-Redis.changes
2021-04-12 17:10:24.418567800 +0200
+++
/work/SRC/openSUSE:Factory/.perl-Mojo-Redis.new.1895/perl-Mojo-Redis.changes
2021-11-27 00:52:35.502539521 +0100
@@ -1,0 +2,16 @@
+Sat Nov 20 03:06:20 UTC 2021 - Tina M??ller <[email protected]>
+
+- updated to 3.27
+ see /usr/share/doc/packages/perl-Mojo-Redis/Changes
+
+ 3.27 2021-11-20T10:51:49+0900
+ - Add experimental "subscribe" and "psubscribe" events to
Mojo::Redis::PubSub
+ - Fix examples for set and expire #62
+ - Fix handling "psubscribe" response from Redis #63
+ - Fix sending database requests after connecting to sentinel server #64
+ - Fix only passing on (p)message messages to listen handlers #67
+ - Remove experimental write_q() method, and replaced it with write()
+ - Remove the ->multi_p(@promises) syntax #68 #70
+ Contributor: Jan "Yenya" Kasprzak
+
+-------------------------------------------------------------------
Old:
----
Mojo-Redis-3.26.tar.gz
New:
----
Mojo-Redis-3.27.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Mojo-Redis.spec ++++++
--- /var/tmp/diff_new_pack.wXwOQI/_old 2021-11-27 00:52:35.942538001 +0100
+++ /var/tmp/diff_new_pack.wXwOQI/_new 2021-11-27 00:52:35.942538001 +0100
@@ -18,7 +18,7 @@
%define cpan_name Mojo-Redis
Name: perl-Mojo-Redis
-Version: 3.26
+Version: 3.27
Release: 0
Summary: Redis driver based on Mojo::IOLoop
License: Artistic-2.0
@@ -42,9 +42,9 @@
It tries to mimic the same interface as Mojo::Pg, Mojo::mysql and
Mojo::SQLite, but the methods for talking to the database vary.
-This module is in no way compatible with the 1.xx version of Mojo::Redis
+This module is in no way compatible with the 1.xx version of 'Mojo::Redis'
and this version also tries to fix a lot of the confusing methods in
-Mojo::Redis2 related to pubsub.
+'Mojo::Redis2' related to pubsub.
This module is currently EXPERIMENTAL, and bad design decisions will be
fixed without warning. Please report at
++++++ Mojo-Redis-3.26.tar.gz -> Mojo-Redis-3.27.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-Redis-3.26/.github/workflows/ci-ubuntu.yml
new/Mojo-Redis-3.27/.github/workflows/ci-ubuntu.yml
--- old/Mojo-Redis-3.26/.github/workflows/ci-ubuntu.yml 2020-08-11
01:59:06.000000000 +0200
+++ new/Mojo-Redis-3.27/.github/workflows/ci-ubuntu.yml 1970-01-01
01:00:00.000000000 +0100
@@ -1,37 +0,0 @@
-name: ci-ubuntu
-on: [push, pull_request]
-jobs:
- perl:
- runs-on: ubuntu-latest
- services:
- redis:
- image: redis
- options: >-
- --health-cmd "redis-cli ping"
- --health-interval 10s
- --health-timeout 5s
- --health-retries 5
- strategy:
- matrix:
- perl-version:
- - '5.16'
- - '5.24'
- - '5.30'
- container:
- image: perl:${{matrix.perl-version}}
- steps:
- - uses: actions/checkout@v2
- - name: perl -V
- run: perl -V
- - name: Fix ExtUtils::MakeMaker (for Perl 5.16 and 5.18)
- run: cpanm -n App::cpanminus ExtUtils::MakeMaker
- - name: Install dependencies
- run: |
- cpanm -n --installdeps .
- cpanm -n Test::Pod Test::Pod::Coverage
- - name: Run tests
- run: prove -l t/*.t
- env:
- HARNESS_OPTIONS: j3
- TEST_ONLINE: redis://redis
- TEST_POD: 1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-Redis-3.26/.travis.yml
new/Mojo-Redis-3.27/.travis.yml
--- old/Mojo-Redis-3.26/.travis.yml 2018-12-07 04:03:30.000000000 +0100
+++ new/Mojo-Redis-3.27/.travis.yml 1970-01-01 01:00:00.000000000 +0100
@@ -1,16 +0,0 @@
-language: perl
-sudo: false
-perl:
- - "5.26"
- - "5.20"
- - "5.14"
- - "5.10"
-services:
- - redis-server
-env:
- - "HARNESS_OPTIONS=j3 TEST_ONLINE=redis://localhost TEST_POD=1"
-install:
- - "cpanm -n Test::Pod Test::Pod::Coverage"
- - "cpanm -n --installdeps ."
-notifications:
- email: false
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-Redis-3.26/.vstags new/Mojo-Redis-3.27/.vstags
--- old/Mojo-Redis-3.26/.vstags 2019-08-08 23:20:36.000000000 +0200
+++ new/Mojo-Redis-3.27/.vstags 1970-01-01 01:00:00.000000000 +0100
@@ -1,190 +0,0 @@
-!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;"
to lines/
-!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
-!_TAG_PROGRAM_AUTHOR Darren Hiebert /[email protected]/
-!_TAG_PROGRAM_NAME Exuberant Ctags //
-!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
-!_TAG_PROGRAM_VERSION 5.8 //
-CONNECT_TIMEOUT lib/Mojo/Redis/Connection.pm 9;" c
-DEBUG lib/Mojo/Redis/Connection.pm 8;" c
-DEBUG lib/Mojo/Redis/PubSub.pm 6;" c
-DESTROY lib/Mojo/Redis/Connection.pm 17;" s
-DESTROY lib/Mojo/Redis/Cursor.pm 129;" s
-DESTROY lib/Mojo/Redis/Database.pm 209;" s
-Mojo::Redis lib/Mojo/Redis.pm 1;" p
-Mojo::Redis::Cache lib/Mojo/Redis/Cache.pm 1;" p
-Mojo::Redis::Cache::OFFLINE lib/Mojo/Redis/Cache.pm 9;" c
-Mojo::Redis::Cache::_compute_p lib/Mojo/Redis/Cache.pm 45;" s
-Mojo::Redis::Cache::_maybe_compute_p lib/Mojo/Redis/Cache.pm 61;" s
-Mojo::Redis::Cache::_offline_connection lib/Mojo/Redis/Cache.pm 84;"
s
-Mojo::Redis::Cache::compute_p lib/Mojo/Redis/Cache.pm 21;" s
-Mojo::Redis::Cache::memoize_p lib/Mojo/Redis/Cache.pm 36;" s
-Mojo::Redis::Connection lib/Mojo/Redis/Connection.pm 1;" p
-Mojo::Redis::Connection::CONNECT_TIMEOUT lib/Mojo/Redis/Connection.pm
9;" c
-Mojo::Redis::Connection::DEBUG lib/Mojo/Redis/Connection.pm 8;" c
-Mojo::Redis::Connection::DESTROY lib/Mojo/Redis/Connection.pm 17;"
s
-Mojo::Redis::Connection::Offline lib/Mojo/Redis/Cache.pm 86;" p
-Mojo::Redis::Connection::Offline::_time lib/Mojo/Redis/Cache.pm 111;"
s
-Mojo::Redis::Connection::Offline::write_p lib/Mojo/Redis/Cache.pm 90;"
s
-Mojo::Redis::Connection::SENTINELS_CONNECT_TIMEOUT
lib/Mojo/Redis/Connection.pm 10;" c
-Mojo::Redis::Connection::_connect lib/Mojo/Redis/Connection.pm 55;"
s
-Mojo::Redis::Connection::_connect_args lib/Mojo/Redis/Connection.pm 94;"
s
-Mojo::Redis::Connection::_discover_master lib/Mojo/Redis/Connection.pm
109;" s
-Mojo::Redis::Connection::_encode lib/Mojo/Redis/Connection.pm 47;"
s
-Mojo::Redis::Connection::_id lib/Mojo/Redis/Connection.pm 147;" s
-Mojo::Redis::Connection::_is_blocking lib/Mojo/Redis/Connection.pm 149;"
s
-Mojo::Redis::Connection::_on_close_cb lib/Mojo/Redis/Connection.pm 151;"
s
-Mojo::Redis::Connection::_on_read_cb lib/Mojo/Redis/Connection.pm 166;"
s
-Mojo::Redis::Connection::_parse_message_cb lib/Mojo/Redis/Connection.pm
178;" s
-Mojo::Redis::Connection::_reject_queue lib/Mojo/Redis/Connection.pm 223;"
s
-Mojo::Redis::Connection::_write lib/Mojo/Redis/Connection.pm 231;"
s
-Mojo::Redis::Connection::disconnect lib/Mojo/Redis/Connection.pm 22;"
s
-Mojo::Redis::Connection::is_connected lib/Mojo/Redis/Connection.pm 30;"
s
-Mojo::Redis::Connection::write_p lib/Mojo/Redis/Connection.pm 32;"
s
-Mojo::Redis::Connection::write_q lib/Mojo/Redis/Connection.pm 40;"
s
-Mojo::Redis::Cursor lib/Mojo/Redis/Cursor.pm 1;" p
-Mojo::Redis::Cursor::DESTROY lib/Mojo/Redis/Cursor.pm 129;" s
-Mojo::Redis::Cursor::_next_p lib/Mojo/Redis/Cursor.pm 107;" s
-Mojo::Redis::Cursor::_process_hgetall lib/Mojo/Redis/Cursor.pm 120;"
s
-Mojo::Redis::Cursor::_process_hkeys lib/Mojo/Redis/Cursor.pm 121;"
s
-Mojo::Redis::Cursor::_process_hscan lib/Mojo/Redis/Cursor.pm 122;"
s
-Mojo::Redis::Cursor::_process_keys lib/Mojo/Redis/Cursor.pm 123;"
s
-Mojo::Redis::Cursor::_process_scan lib/Mojo/Redis/Cursor.pm 124;"
s
-Mojo::Redis::Cursor::_process_smembers lib/Mojo/Redis/Cursor.pm 125;"
s
-Mojo::Redis::Cursor::_process_sscan lib/Mojo/Redis/Cursor.pm 126;"
s
-Mojo::Redis::Cursor::_process_zscan lib/Mojo/Redis/Cursor.pm 127;"
s
-Mojo::Redis::Cursor::again lib/Mojo/Redis/Cursor.pm 11;" s
-Mojo::Redis::Cursor::all lib/Mojo/Redis/Cursor.pm 18;" s
-Mojo::Redis::Cursor::all_p lib/Mojo/Redis/Cursor.pm 46;" s
-Mojo::Redis::Cursor::command lib/Mojo/Redis/Cursor.pm 7;" s
-Mojo::Redis::Cursor::finished lib/Mojo/Redis/Cursor.pm 8;" s
-Mojo::Redis::Cursor::new lib/Mojo/Redis/Cursor.pm 86;" s
-Mojo::Redis::Cursor::next lib/Mojo/Redis/Cursor.pm 60;" s
-Mojo::Redis::Cursor::next_p lib/Mojo/Redis/Cursor.pm 81;" s
-Mojo::Redis::Database lib/Mojo/Redis/Database.pm 1;" p
-Mojo::Redis::Database::DESTROY lib/Mojo/Redis/Database.pm 209;" s
-Mojo::Redis::Database::_add_method lib/Mojo/Redis/Database.pm 110;"
s
-Mojo::Redis::Database::_generate_bnb_method lib/Mojo/Redis/Database.pm
136;" s
-Mojo::Redis::Database::_generate_nb_method lib/Mojo/Redis/Database.pm
160;" s
-Mojo::Redis::Database::_generate_p_method lib/Mojo/Redis/Database.pm
171;" s
-Mojo::Redis::Database::_process_blpop lib/Mojo/Redis/Database.pm 183;"
s
-Mojo::Redis::Database::_process_brpop lib/Mojo/Redis/Database.pm 184;"
s
-Mojo::Redis::Database::_process_geopos lib/Mojo/Redis/Database.pm 182;"
s
-Mojo::Redis::Database::_process_hgetall lib/Mojo/Redis/Database.pm
185;" s
-Mojo::Redis::Database::_process_info_structured
lib/Mojo/Redis/Database.pm 187;" s
-Mojo::Redis::Database::_process_xread_structured
lib/Mojo/Redis/Database.pm 204;" s
-Mojo::Redis::Database::call lib/Mojo/Redis/Database.pm 59;" s
-Mojo::Redis::Database::call_p lib/Mojo/Redis/Database.pm 77;" s
-Mojo::Redis::Database::connection lib/Mojo/Redis/Database.pm 126;"
s
-Mojo::Redis::Database::discard lib/Mojo/Redis/Database.pm 90;" s
-Mojo::Redis::Database::discard_p lib/Mojo/Redis/Database.pm 92;"
s
-Mojo::Redis::Database::exec lib/Mojo/Redis/Database.pm 82;" s
-Mojo::Redis::Database::exec_p lib/Mojo/Redis/Database.pm 84;" s
-Mojo::Redis::Database::multi lib/Mojo/Redis/Database.pm 98;" s
-Mojo::Redis::Database::multi_p lib/Mojo/Redis/Database.pm 103;" s
-Mojo::Redis::PubSub lib/Mojo/Redis/PubSub.pm 1;" p
-Mojo::Redis::PubSub::DEBUG lib/Mojo/Redis/PubSub.pm 6;" c
-Mojo::Redis::PubSub::_keyspace_key lib/Mojo/Redis/PubSub.pm 71;"
s
-Mojo::Redis::PubSub::_listen lib/Mojo/Redis/PubSub.pm 83;" s
-Mojo::Redis::PubSub::_reconnect lib/Mojo/Redis/PubSub.pm 114;"
s
-Mojo::Redis::PubSub::channels_p lib/Mojo/Redis/PubSub.pm 13;"
s
-Mojo::Redis::PubSub::json lib/Mojo/Redis/PubSub.pm 17;" s
-Mojo::Redis::PubSub::keyspace_listen lib/Mojo/Redis/PubSub.pm 19;"
s
-Mojo::Redis::PubSub::keyspace_unlisten lib/Mojo/Redis/PubSub.pm 26;"
s
-Mojo::Redis::PubSub::listen lib/Mojo/Redis/PubSub.pm 31;" s
-Mojo::Redis::PubSub::notify lib/Mojo/Redis/PubSub.pm 40;" s
-Mojo::Redis::PubSub::notify_p lib/Mojo/Redis/PubSub.pm 44;" s
-Mojo::Redis::PubSub::numpat_p lib/Mojo/Redis/PubSub.pm 54;" s
-Mojo::Redis::PubSub::numsub_p lib/Mojo/Redis/PubSub.pm 50;" s
-Mojo::Redis::PubSub::unlisten lib/Mojo/Redis/PubSub.pm 58;" s
-Mojo::Redis::_blocking_connection lib/Mojo/Redis.pm 63;" s
-Mojo::Redis::_connection lib/Mojo/Redis.pm 47;" s
-Mojo::Redis::_dequeue lib/Mojo/Redis.pm 74;" s
-Mojo::Redis::_enqueue lib/Mojo/Redis.pm 84;" s
-Mojo::Redis::_fork_safety lib/Mojo/Redis.pm 91;" s
-Mojo::Redis::cache lib/Mojo/Redis.pm 35;" s
-Mojo::Redis::cursor lib/Mojo/Redis.pm 36;" s
-Mojo::Redis::db lib/Mojo/Redis.pm 37;" s
-Mojo::Redis::new lib/Mojo/Redis.pm 39;" s
-OFFLINE lib/Mojo/Redis/Cache.pm 9;" c
-SENTINELS_CONNECT_TIMEOUT lib/Mojo/Redis/Connection.pm 10;" c
-_add_method lib/Mojo/Redis/Database.pm 110;" s
-_blocking_connection lib/Mojo/Redis.pm 63;" s
-_compute_p lib/Mojo/Redis/Cache.pm 45;" s
-_connect lib/Mojo/Redis/Connection.pm 55;" s
-_connect_args lib/Mojo/Redis/Connection.pm 94;" s
-_connection lib/Mojo/Redis.pm 47;" s
-_dequeue lib/Mojo/Redis.pm 74;" s
-_discover_master lib/Mojo/Redis/Connection.pm 109;" s
-_encode lib/Mojo/Redis/Connection.pm 47;" s
-_enqueue lib/Mojo/Redis.pm 84;" s
-_fork_safety lib/Mojo/Redis.pm 91;" s
-_generate_bnb_method lib/Mojo/Redis/Database.pm 136;" s
-_generate_nb_method lib/Mojo/Redis/Database.pm 160;" s
-_generate_p_method lib/Mojo/Redis/Database.pm 171;" s
-_id lib/Mojo/Redis/Connection.pm 147;" s
-_is_blocking lib/Mojo/Redis/Connection.pm 149;" s
-_keyspace_key lib/Mojo/Redis/PubSub.pm 71;" s
-_listen lib/Mojo/Redis/PubSub.pm 83;" s
-_maybe_compute_p lib/Mojo/Redis/Cache.pm 61;" s
-_next_p lib/Mojo/Redis/Cursor.pm 107;" s
-_offline_connection lib/Mojo/Redis/Cache.pm 84;" s
-_on_close_cb lib/Mojo/Redis/Connection.pm 151;" s
-_on_read_cb lib/Mojo/Redis/Connection.pm 166;" s
-_parse_message_cb lib/Mojo/Redis/Connection.pm 178;" s
-_process_blpop lib/Mojo/Redis/Database.pm 183;" s
-_process_brpop lib/Mojo/Redis/Database.pm 184;" s
-_process_geopos lib/Mojo/Redis/Database.pm 182;" s
-_process_hgetall lib/Mojo/Redis/Cursor.pm 120;" s
-_process_hgetall lib/Mojo/Redis/Database.pm 185;" s
-_process_hkeys lib/Mojo/Redis/Cursor.pm 121;" s
-_process_hscan lib/Mojo/Redis/Cursor.pm 122;" s
-_process_info_structured lib/Mojo/Redis/Database.pm 187;" s
-_process_keys lib/Mojo/Redis/Cursor.pm 123;" s
-_process_scan lib/Mojo/Redis/Cursor.pm 124;" s
-_process_smembers lib/Mojo/Redis/Cursor.pm 125;" s
-_process_sscan lib/Mojo/Redis/Cursor.pm 126;" s
-_process_xread_structured lib/Mojo/Redis/Database.pm 204;" s
-_process_zscan lib/Mojo/Redis/Cursor.pm 127;" s
-_reconnect lib/Mojo/Redis/PubSub.pm 114;" s
-_reject_queue lib/Mojo/Redis/Connection.pm 223;" s
-_time lib/Mojo/Redis/Cache.pm 111;" s
-_write lib/Mojo/Redis/Connection.pm 231;" s
-add_dummy_user examples/twitter.pl 102;" s
-again lib/Mojo/Redis/Cursor.pm 11;" s
-all lib/Mojo/Redis/Cursor.pm 18;" s
-all_p lib/Mojo/Redis/Cursor.pm 46;" s
-cache lib/Mojo/Redis.pm 35;" s
-call lib/Mojo/Redis/Database.pm 59;" s
-call_p lib/Mojo/Redis/Database.pm 77;" s
-channels_p lib/Mojo/Redis/PubSub.pm 13;" s
-command lib/Mojo/Redis/Cursor.pm 7;" s
-compute_p lib/Mojo/Redis/Cache.pm 21;" s
-connection lib/Mojo/Redis/Database.pm 126;" s
-cursor lib/Mojo/Redis.pm 36;" s
-db lib/Mojo/Redis.pm 37;" s
-discard lib/Mojo/Redis/Database.pm 90;" s
-discard_p lib/Mojo/Redis/Database.pm 92;" s
-disconnect lib/Mojo/Redis/Connection.pm 22;" s
-exec lib/Mojo/Redis/Database.pm 82;" s
-exec_p lib/Mojo/Redis/Database.pm 84;" s
-finished lib/Mojo/Redis/Cursor.pm 8;" s
-is_connected lib/Mojo/Redis/Connection.pm 30;" s
-json lib/Mojo/Redis/PubSub.pm 17;" s
-keyspace_listen lib/Mojo/Redis/PubSub.pm 19;" s
-keyspace_unlisten lib/Mojo/Redis/PubSub.pm 26;" s
-listen lib/Mojo/Redis/PubSub.pm 31;" s
-memoize_p lib/Mojo/Redis/Cache.pm 36;" s
-multi lib/Mojo/Redis/Database.pm 98;" s
-multi_p lib/Mojo/Redis/Database.pm 103;" s
-new lib/Mojo/Redis.pm 39;" s
-new lib/Mojo/Redis/Cursor.pm 86;" s
-next lib/Mojo/Redis/Cursor.pm 60;" s
-next_p lib/Mojo/Redis/Cursor.pm 81;" s
-notify lib/Mojo/Redis/PubSub.pm 40;" s
-notify_p lib/Mojo/Redis/PubSub.pm 44;" s
-numpat_p lib/Mojo/Redis/PubSub.pm 54;" s
-numsub_p lib/Mojo/Redis/PubSub.pm 50;" s
-unlisten lib/Mojo/Redis/PubSub.pm 58;" s
-write_p lib/Mojo/Redis/Cache.pm 90;" s
-write_p lib/Mojo/Redis/Connection.pm 32;" s
-write_q lib/Mojo/Redis/Connection.pm 40;" s
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-Redis-3.26/Changes new/Mojo-Redis-3.27/Changes
--- old/Mojo-Redis-3.26/Changes 2021-03-01 01:01:51.000000000 +0100
+++ new/Mojo-Redis-3.27/Changes 2021-11-20 02:51:49.000000000 +0100
@@ -1,5 +1,15 @@
Revision history for perl distribution Mojo-Redis
+3.27 2021-11-20T10:51:49+0900
+ - Add experimental "subscribe" and "psubscribe" events to Mojo::Redis::PubSub
+ - Fix examples for set and expire #62
+ - Fix handling "psubscribe" response from Redis #63
+ - Fix sending database requests after connecting to sentinel server #64
+ - Fix only passing on (p)message messages to listen handlers #67
+ - Remove experimental write_q() method, and replaced it with write()
+ - Remove the ->multi_p(@promises) syntax #68 #70
+ Contributor: Jan "Yenya" Kasprzak
+
3.26 2021-03-01T09:01:51+0900
- Avoid circular reference in redis response parser
Contributor: Dan Book
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-Redis-3.26/MANIFEST new/Mojo-Redis-3.27/MANIFEST
--- old/Mojo-Redis-3.26/MANIFEST 2021-03-01 01:01:52.000000000 +0100
+++ new/Mojo-Redis-3.27/MANIFEST 2021-11-20 02:51:50.000000000 +0100
@@ -1,7 +1,4 @@
-.github/workflows/ci-ubuntu.yml
.perltidyrc
-.travis.yml
-.vstags
Changes
cpanfile
examples/cache.pl
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-Redis-3.26/META.json
new/Mojo-Redis-3.27/META.json
--- old/Mojo-Redis-3.26/META.json 2021-03-01 01:01:52.000000000 +0100
+++ new/Mojo-Redis-3.27/META.json 2021-11-20 02:51:50.000000000 +0100
@@ -4,7 +4,7 @@
"Jan Henning Thorsen <[email protected]>"
],
"dynamic_config" : 0,
- "generated_by" : "ExtUtils::MakeMaker version 7.44, CPAN::Meta::Converter
version 2.150010",
+ "generated_by" : "ExtUtils::MakeMaker version 7.62, CPAN::Meta::Converter
version 2.150010",
"license" : [
"artistic_2"
],
@@ -53,10 +53,10 @@
"web" : "https://github.com/jhthorsen/mojo-redis"
}
},
- "version" : "3.26",
+ "version" : "3.27",
"x_contributors" : [
"Jan Henning Thorsen <[email protected]>",
"Dan Book <[email protected]>"
],
- "x_serialization_backend" : "JSON::PP version 4.04"
+ "x_serialization_backend" : "JSON::PP version 4.06"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-Redis-3.26/META.yml new/Mojo-Redis-3.27/META.yml
--- old/Mojo-Redis-3.26/META.yml 2021-03-01 01:01:52.000000000 +0100
+++ new/Mojo-Redis-3.27/META.yml 2021-11-20 02:51:50.000000000 +0100
@@ -7,7 +7,7 @@
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 0
-generated_by: 'ExtUtils::MakeMaker version 7.44, CPAN::Meta::Converter version
2.150010'
+generated_by: 'ExtUtils::MakeMaker version 7.62, CPAN::Meta::Converter version
2.150010'
license: artistic_2
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -25,7 +25,7 @@
bugtracker: https://github.com/jhthorsen/mojo-redis/issues
homepage: https://github.com/jhthorsen/mojo-redis
repository: https://github.com/jhthorsen/mojo-redis.git
-version: '3.26'
+version: '3.27'
x_contributors:
- 'Jan Henning Thorsen <[email protected]>'
- 'Dan Book <[email protected]>'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-Redis-3.26/README.md
new/Mojo-Redis-3.27/README.md
--- old/Mojo-Redis-3.26/README.md 2021-03-01 01:01:51.000000000 +0100
+++ new/Mojo-Redis-3.27/README.md 2021-11-20 02:51:49.000000000 +0100
@@ -8,7 +8,9 @@
use Mojo::Redis;
my $redis = Mojo::Redis->new;
- warn $redis->db->get("mykey");
+ $redis->db->set(foo => 42);
+ $redis->expire(foo => 600);
+ warn $redis->db->get('foo');
## Promises
@@ -42,9 +44,9 @@
It tries to mimic the same interface as
[Mojo::Pg](https://metacpan.org/pod/Mojo%3A%3APg),
[Mojo::mysql](https://metacpan.org/pod/Mojo%3A%3Amysql) and
[Mojo::SQLite](https://metacpan.org/pod/Mojo%3A%3ASQLite), but the methods for
talking to the database vary.
-This module is in no way compatible with the 1.xx version of
[Mojo::Redis](https://metacpan.org/pod/Mojo%3A%3ARedis)
+This module is in no way compatible with the 1.xx version of `Mojo::Redis`
and this version also tries to fix a lot of the confusing methods in
-[Mojo::Redis2](https://metacpan.org/pod/Mojo%3A%3ARedis2) related to pubsub.
+`Mojo::Redis2` related to pubsub.
This module is currently EXPERIMENTAL, and bad design decisions will be fixed
without warning. Please report at
@@ -148,7 +150,3 @@
This program is free software, you can redistribute it and/or modify it under
the terms of the Artistic License version 2.0.
-
-# SEE ALSO
-
-[Mojo::Redis2](https://metacpan.org/pod/Mojo%3A%3ARedis2).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-Redis-3.26/lib/Mojo/Redis/Connection.pm
new/Mojo-Redis-3.27/lib/Mojo/Redis/Connection.pm
--- old/Mojo-Redis-3.26/lib/Mojo/Redis/Connection.pm 2021-03-01
00:56:23.000000000 +0100
+++ new/Mojo-Redis-3.27/lib/Mojo/Redis/Connection.pm 2021-11-20
02:05:45.000000000 +0100
@@ -29,27 +29,19 @@
sub is_connected { $_[0]->{stream} && !$_[0]->{gone_away} ? 1 : 0 }
-sub write_p {
+sub write {
my $self = shift;
- my $p = Mojo::Promise->new->ioloop($self->ioloop);
- $self->write_q(@_, $p);
+ push @{$self->{write}}, [$self->_encode(@_)];
$self->is_connected ? $self->_write : $self->_connect;
- return $p;
+ return $self;
}
-sub write_q {
- my $p = pop;
+sub write_p {
my $self = shift;
+ my $p = Mojo::Promise->new->ioloop($self->ioloop);
push @{$self->{write}}, [$self->_encode(@_), $p];
- return $self;
-}
-
-sub _encode {
- my $self = shift;
- my $encoding = $self->encoding;
- return $self->protocol->encode({
- type => '*', data => [map { +{type => '$', data => $encoding ?
Mojo::Util::encode($encoding, $_) : $_} } @_]
- });
+ $self->is_connected ? $self->_write : $self->_connect;
+ return $p;
}
sub _connect {
@@ -128,15 +120,26 @@
$stream->on(read => $self->_on_read_cb);
$self->{stream} = $stream;
- unshift @{$self->{write}}, [$self->_encode(AUTH => $url->password)] if
length $url->password;
- $self->write_p(SENTINEL => 'get-master-addr-by-name' =>
$self->url->host)->then(sub {
- my $host_port = shift;
- delete $self->{id};
- return $self->_discover_master unless ref $host_port and @$host_port
== 2;
- $self->{master_url} =
$self->url->clone->host($host_port->[0])->port($host_port->[1]);
- $self->{stream}->close;
- $self->_connect;
- })->catch(sub { $self->_discover_master });
+ my $p = Mojo::Promise->new;
+ unshift @{$self->{write}}, undef; # prevent _write() from writing
commands
+ unshift @{$self->{write}}, [$self->_encode(SENTINEL =>
'get-master-addr-by-name', $self->url->host), $p];
+ unshift @{$self->{write}}, [$self->_encode(AUTH => $url->password)]
if length $url->password;
+
+ $self->{write_lock} = 1;
+ $p->then(
+ sub {
+ my $host_port = shift;
+ delete $self->{id};
+ delete $self->{write_lock};
+ return $self->_discover_master unless ref $host_port and @$host_port
== 2;
+ $self->{master_url} =
$self->url->clone->host($host_port->[0])->port($host_port->[1]);
+ $self->{stream}->close;
+ $self->_connect;
+ },
+ sub { $self->_discover_master },
+ );
+
+ $self->_write;
}
);
@@ -144,6 +147,14 @@
return $self;
}
+sub _encode {
+ my $self = shift;
+ my $encoding = $self->encoding;
+ return $self->protocol->encode({
+ type => '*', data => [map { +{type => '$', data => $encoding ?
Mojo::Util::encode($encoding, $_) : $_} } @_]
+ });
+}
+
sub _id { $_[0]->{id} || '0' }
sub _is_blocking { shift->ioloop eq Mojo::IOLoop->singleton ? 0 : 1 }
@@ -182,7 +193,7 @@
return sub {
my ($protocol, @messages) = @_;
my $encoding = $self->encoding;
- $self->_write;
+ $self->_write unless $self->{write_lock};
my $unpack = sub {
my @res;
@@ -291,8 +302,7 @@
$cb = $conn->on(response => sub { my ($conn, $res) = @_; });
-Emitted if L</write_q> is not passed a L<Mojo::Promise> as the last argument,
-or if the Redis server emits a message that is not handled.
+Emitted when receiving a message from the Redis server.
=head1 ATTRIBUTES
@@ -340,23 +350,21 @@
True if a connection to the Redis server is established.
-=head2 write_p
+=head2 write
- $promise = $conn->write_p($command => @args);
+ $conn = $conn->write(@command_and_args);
-Will write a command to the Redis server and establish a connection if not
-already connected and returns a L<Mojo::Promise>. The arguments will be
-passed on to L</write_q>.
+Used to write a message to the redis server. Calling this method should result
+in either a L</error> or L</response> event.
-=head2 write_q
+This is useful in the a
- $conn = $conn->write_q(@command => @args, Mojo::Promise->new);
- $conn = $conn->write_q(@command => @args, undef);
+=head2 write_p
-Will enqueue a Redis command and either resolve/reject the L<Mojo::Promise>
-or emit a L</error> or L</response> event when the Redis server responds.
+ $promise = $conn->write_p(@command_and_args);
-This method is EXPERIMENTAL and currently meant for internal use.
+Will write a command to the Redis server and establish a connection if not
+already connected and returns a L<Mojo::Promise>.
=head1 SEE ALSO
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-Redis-3.26/lib/Mojo/Redis/Database.pm
new/Mojo-Redis-3.27/lib/Mojo/Redis/Database.pm
--- old/Mojo-Redis-3.26/lib/Mojo/Redis/Database.pm 2020-10-02
03:20:38.000000000 +0200
+++ new/Mojo-Redis-3.27/lib/Mojo/Redis/Database.pm 2021-11-20
02:03:23.000000000 +0100
@@ -102,9 +102,10 @@
sub multi_p {
my ($self, @p) = @_;
+ Carp::croak('multi_p(@promises) syntax is not supported anymore. Use promise
chaining instead.')
+ if @p;
$self->{txn} = 'default';
- my $p = $self->connection->write_p('MULTI');
- return @p ? $p->then(sub { Mojo::Promise->all(@p) }) : $p;
+ return $self->connection->write_p('MULTI');
}
sub _add_method {
@@ -1081,21 +1082,26 @@
$res = $db->multi;
$db = $db->multi(sub { my ($db, $err, $res) = @_ });
$promise = $db->multi_p;
- $promise = $db->multi_p(@promises);
Mark the start of a transaction block. Commands issued after L</multi> will
automatically be discarded if C<$db> goes out of scope. Need to call
L</exec> to commit the queued commands to Redis.
-When calling L</multi_p>, you can directly pass in the new instructions:
-
- $db->multi_p(
- $db->set_p("x:y:z" => 1011),
- $db->get_p("x:y:z"),
- $db->incr_p("x:y:z"),
- $db->incrby_p("x:y:z" => -10),
- )->then(sub {
- });
+NOTE: the previously supported C<multi_p(@promises)> syntax has been removed,
+because it did not work as expected. See
+L<https://github.com/jhthorsen/mojo-redis/issues/68> for details.
+When L</multi_p> gets called with non-zero arguments, it C<croak()>s.
+Use the promise chaining instead:
+
+ $db->multi_p->then(sub {
+ Mojo::Promise->all(
+ $db->set_p(...),
+ $db->incr_p(...),
+ ...
+ );
+ })->then(sub {
+ $db->exec_p;
+ })->then ...
See L<https://redis.io/commands/multi> for more information.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-Redis-3.26/lib/Mojo/Redis/PubSub.pm
new/Mojo-Redis-3.27/lib/Mojo/Redis/PubSub.pm
--- old/Mojo-Redis-3.26/lib/Mojo/Redis/PubSub.pm 2020-10-02
03:20:52.000000000 +0200
+++ new/Mojo-Redis-3.27/lib/Mojo/Redis/PubSub.pm 2021-11-20
02:48:14.000000000 +0100
@@ -5,7 +5,18 @@
use constant DEBUG => $ENV{MOJO_REDIS_DEBUG};
-has connection => sub { shift->redis->_connection };
+has connection => sub {
+ my $self = shift;
+ my $conn = $self->redis->_connection;
+
+ Scalar::Util::weaken($self);
+ for my $name (qw(close error response)) {
+ my $handler = "_on_$name";
+ $conn->on($name => sub { $self and $self->$handler(@_) });
+ }
+
+ return $conn;
+};
has db => sub {
my $self = shift;
@@ -17,11 +28,8 @@
has reconnect_interval => 1;
has redis => sub { Carp::confess('redis is requried in
constructor') };
-sub channels_p {
- shift->db->call_p(qw(PUBSUB CHANNELS), @_);
-}
-
-sub json { ++$_[0]{json}{$_[1]} and return $_[0] }
+sub channels_p { shift->db->call_p(qw(PUBSUB CHANNELS), @_) }
+sub json { ++$_[0]{json}{$_[1]} and return $_[0] }
sub keyspace_listen {
my ($self, $cb) = (shift, pop);
@@ -38,27 +46,24 @@
sub listen {
my ($self, $name, $cb) = @_;
- $self->_listen($name) unless @{$self->{chans}{$name} ||= []};
- push @{$self->{chans}{$name}}, $cb;
+ unless (@{$self->{chans}{$name} ||= []}) {
+ Mojo::IOLoop->remove(delete $self->{reconnect_tid}) if
$self->{reconnect_tid};
+ $self->_write([($name =~ /\*/ ? 'PSUBSCRIBE' : 'SUBSCRIBE') => $name]);
+ }
+ push @{$self->{chans}{$name}}, $cb;
return $cb;
}
sub notify_p {
my ($self, $name, $payload) = @_;
$payload = to_json $payload if $self->{json}{$name};
- shift->db->call_p(PUBLISH => $name, $payload);
+ return $self->db->call_p(PUBLISH => $name, $payload);
}
-sub notify { shift->notify_p(@_)->wait }
-
-sub numsub_p {
- shift->db->call_p(qw(PUBSUB NUMSUB), @_)->then(sub { +{@{$_[0]}} });
-}
-
-sub numpat_p {
- shift->db->call_p(qw(PUBSUB NUMPAT));
-}
+sub notify { shift->notify_p(@_)->wait }
+sub numpat_p { shift->db->call_p(qw(PUBSUB NUMPAT)) }
+sub numsub_p { shift->db->call_p(qw(PUBSUB NUMSUB), @_)->then(\&_flatten) }
sub unlisten {
my ($self, $name, $cb) = @_;
@@ -66,66 +71,67 @@
@$chans = $cb ? grep { $cb ne $_ } @$chans : ();
unless (@$chans) {
- $self->connection->write_p(($name =~ /\*/ ? 'PUNSUBSCRIBE' :
'UNSUBSCRIBE'), $name);
+ my $conn = $self->connection;
+ $conn->write(($name =~ /\*/ ? 'PUNSUBSCRIBE' : 'UNSUBSCRIBE'), $name) if
$conn->is_connected;
delete $self->{chans}{$name};
}
return $self;
}
+sub _flatten { +{@{$_[0]}} }
+
sub _keyspace_key {
my $args = ref $_[-1] eq 'HASH' ? pop : {};
my $self = shift;
- local $args->{key} = $_[0] // $args->{key} // '*';
- local $args->{op} = $_[1] // $args->{op} // '*';
+ local $args->{key} = $_[0] // $args->{key} // '*';
+ local $args->{op} = $_[1] // $args->{op} // '*';
local $args->{type} = $args->{type} || ($args->{key} eq '*' ? 'keyevent' :
'keyspace');
return sprintf '__%s@%s__:%s', $args->{type}, $args->{db} //
$self->redis->url->path->[0] // '*',
$args->{type} eq 'keyevent' ? $args->{op} : $args->{key};
}
-sub _listen {
- my ($self, $name) = @_;
+sub _on_close {
+ my $self = shift;
+ $self->emit(disconnect => $self->connection);
- if ($self->{setup}) {
- my $op = $name =~ /\*/ ? 'PSUBSCRIBE' : 'SUBSCRIBE';
- return $self->connection->write_p($op => $name);
- }
+ my $delay = $self->reconnect_interval;
+ return $self if $delay < 0 or $self->{reconnect_tid};
+ warn qq([Mojo::Redis::PubSub] Reconnecting in ${delay}s...\n) if DEBUG;
Scalar::Util::weaken($self);
- my $conn = $self->connection;
- my $reconnecting = delete $self->{reconnecting};
-
- $self->{setup} = 1;
- $conn->once(close => sub { $self and $self->_reconnect->emit(disconnect =>
shift) });
- $conn->on(
- response => sub {
- my ($conn, $res) = @_; # $res = [$type, $name, $payload]
- return unless ref $res eq 'ARRAY' and @$res >= 3;
- $res->[2] = eval { from_json $res->[2] } if $self->{json}{$res->[1]};
- my $keyspace_listen = $self->{keyspace_listen}{$res->[1]};
- for my $cb (@{$self->{chans}{$res->[1]}}) { $self->$cb($keyspace_listen
? [@$res[2, 3]] : $res->[2]) }
- }
- );
-
- $self->emit(before_connect => $conn);
- return $self unless my @p = map { $self->_listen($_) } keys
%{$self->{chans}};
- Mojo::Promise->all(@p)->then(sub { $self->emit(reconnect => $conn) if
$reconnecting }, sub { $self->_reconnect });
+ $self->{reconnect} = 1;
+ $self->{reconnect_tid} = Mojo::IOLoop->timer($delay => sub { $self and
$self->_reconnect });
return $self;
+}
+
+sub _on_error { $_[0]->emit(error => $_[2]) }
+sub _on_response {
+ my ($self, $conn, $res) = @_;
+ $self->emit(reconnect => $conn) if delete $self->{reconnect};
+
+ return unless ref $res eq 'ARRAY';
+ return $self->emit(@$res) unless $res->[0] =~ m!^p?message$!i;
+ my ($psub) = $res->[0] eq 'pmessage' ? splice @$res, 1, 1 : ();
+ $res->[2] = eval { from_json $res->[2] } if $self->{json}{$res->[1]};
+ my $keyspace_listen = $self->{keyspace_listen}{$psub || $res->[1]};
+ for my $cb (@{$self->{chans}{$psub || $res->[1]}}) {
$self->$cb($keyspace_listen ? [@$res[1, 2]] : $res->[2]) }
}
sub _reconnect {
my $self = shift;
- delete @$self{qw(connection db setup)};
-
- my $delay = $self->reconnect_interval;
- return $self if $delay < 0 or $self->{reconnecting}++;
+ delete $self->{$_} for qw(before_connect connection reconnect_tid);
+ $self->_write(map { [(/\*/ ? 'PSUBSCRIBE' : 'SUBSCRIBE') => $_] } keys
%{$self->{chans}});
+}
- warn qq([Mojo::Redis::PubSub] Reconnecting in ${delay}s...\n) if DEBUG;
- Mojo::IOLoop->timer($delay => sub { $self->_listen });
- return $self;
+sub _write {
+ my ($self, @commands) = @_;
+ my $conn = $self->connection;
+ $self->emit(before_connect => $conn) unless $self->{before_connect}++;
+ $conn->write(@$_) for @commands;
}
1;
@@ -182,6 +188,15 @@
Emitted after L</connection> is disconnected from the redis server.
+=head2 psubscribe
+
+ $pubsub->on(psubscribe => sub { my ($pubsub, $channel, $success) = @_; ...
});
+
+Emitted when the server responds to the L</listen> request and/or when
+L</reconnect> resends psubscribe messages.
+
+This event is EXPERIMENTAL.
+
=head2 reconnect
$pubsub->on(reconnect => sub { my ($pubsub, $conn) = @_; ... });
@@ -189,6 +204,15 @@
Emitted after switching the L</connection> with a new connection. This event
will only happen if L</reconnect_interval> is 0 or more.
+=head2 subscribe
+
+ $pubsub->on(subscribe => sub { my ($pubsub, $channel, $success) = @_; ... });
+
+Emitted when the server responds to the L</listen> request and/or when
+L</reconnect> resends subscribe messages.
+
+This event is EXPERIMENTAL.
+
=head1 ATTRIBUTES
=head2 db
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-Redis-3.26/lib/Mojo/Redis.pm
new/Mojo-Redis-3.27/lib/Mojo/Redis.pm
--- old/Mojo-Redis-3.26/lib/Mojo/Redis.pm 2021-03-01 01:01:51.000000000
+0100
+++ new/Mojo-Redis-3.27/lib/Mojo/Redis.pm 2021-11-20 02:51:49.000000000
+0100
@@ -9,7 +9,7 @@
use Mojo::Redis::PubSub;
use Scalar::Util 'blessed';
-our $VERSION = '3.26';
+our $VERSION = '3.27';
$ENV{MOJO_REDIS_URL} ||= 'redis://localhost:6379';
@@ -109,7 +109,9 @@
use Mojo::Redis;
my $redis = Mojo::Redis->new;
- warn $redis->db->get("mykey");
+ $redis->db->set(foo => 42);
+ $redis->expire(foo => 600);
+ warn $redis->db->get('foo');
=head2 Promises
@@ -143,9 +145,9 @@
It tries to mimic the same interface as L<Mojo::Pg>, L<Mojo::mysql> and
L<Mojo::SQLite>, but the methods for talking to the database vary.
-This module is in no way compatible with the 1.xx version of L<Mojo::Redis>
+This module is in no way compatible with the 1.xx version of C<Mojo::Redis>
and this version also tries to fix a lot of the confusing methods in
-L<Mojo::Redis2> related to pubsub.
+C<Mojo::Redis2> related to pubsub.
This module is currently EXPERIMENTAL, and bad design decisions will be fixed
without warning. Please report at
@@ -250,8 +252,4 @@
This program is free software, you can redistribute it and/or modify it under
the terms of the Artistic License version 2.0.
-=head1 SEE ALSO
-
-L<Mojo::Redis2>.
-
=cut
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-Redis-3.26/t/connection-sentinel.t
new/Mojo-Redis-3.27/t/connection-sentinel.t
--- old/Mojo-Redis-3.26/t/connection-sentinel.t 2019-04-24 07:30:37.000000000
+0200
+++ new/Mojo-Redis-3.27/t/connection-sentinel.t 2021-06-17 05:23:25.000000000
+0200
@@ -12,28 +12,29 @@
sub {
my ($loop, $stream) = @_;
my $protocol = $redis->protocol_class->new(api => 1);
- my @res = ({type => '$', data => 'OK'});
+ my @res = ({type => '$', data => 'OK'});
push @res,
$conn_n == 0
? {type => '$', data => 'IDONTKNOW'}
: {type => '*', data => [{type => '$', data => 'localhost'}, {type =>
'$', data => $port}]};
+ push @res, {type => '$', data => 42};
+
my $cid = ++$conn_n;
$protocol->on_message(sub {
push @messages, pop;
$messages[-1]{c} = $cid;
$stream->write($protocol->encode(shift @res)) if @res;
- Mojo::IOLoop->stop if $messages[-1]{data}[0]{data} eq 'SELECT';
});
$stream->on(read => sub { $protocol->parse(pop) });
}
);
-my $db = $redis->db;
-$db->connection->_connect;
-Mojo::IOLoop->start;
+my $foo;
+$redis->db->get_p('foo')->then(sub { $foo = shift })->wait;
+is $foo, 42, 'get foo';
my @get_master_addr_by_name = (
{data => 'SENTINEL', type => '$'},
@@ -48,10 +49,11 @@
{c => 1, data => \@get_master_addr_by_name,
type => '*'},
{c => 2, data => [{data => 'AUTH', type => '$'}, {data => 's3cret', type
=> '$'}], type => '*'},
{c => 2, data => \@get_master_addr_by_name,
type => '*'},
- {c => 3, data => [{data => 'AUTH', type => '$'}, {data => 's3cret', type
=> '$'}], type => '*'},
- {c => 3, data => [{data => 'SELECT', type => '$'}, {data => '12', type
=> '$'}], type => '*'},
+ {c => 3, data => [{data => 'AUTH', type => '$'}, {data => 's3cret', type
=> '$'}], type => '*'},
+ {c => 3, data => [{data => 'SELECT', type => '$'}, {data => '12', type =>
'$'}], type => '*'},
+ {c => 3, data => [{data => 'GET', type => '$'}, {data => 'foo', type =>
'$'}], type => '*'},
],
- 'discovery + connect'
-);
+ 'discovery + connect + command'
+) or diag explain \@messages;
done_testing;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-Redis-3.26/t/keyspace-listen.t
new/Mojo-Redis-3.27/t/keyspace-listen.t
--- old/Mojo-Redis-3.26/t/keyspace-listen.t 2019-05-07 17:24:47.000000000
+0200
+++ new/Mojo-Redis-3.27/t/keyspace-listen.t 2021-06-17 04:47:30.000000000
+0200
@@ -3,9 +3,11 @@
use Mojo::Redis;
my @events;
-my $redis = Mojo::Redis->new('redis://localhost');
+my $redis = Mojo::Redis->new($ENV{TEST_ONLINE} || 'redis://localhost');
my $pubsub = $redis->pubsub;
-is $pubsub->_keyspace_key, '__keyevent@*__:*', 'keyevent default db wildcard';
+
+my $dbsel = $redis->url->path->[0] // '*';
+is $pubsub->_keyspace_key, '__keyevent@'.$dbsel.'__:*', 'keyevent default db
wildcard';
$redis->url->path->parse('/5');
is $pubsub->_keyspace_key, '__keyevent@5__:*', 'keyevent default wildcard';
@@ -25,9 +27,8 @@
is $pubsub->keyspace_unlisten(undef, 'del', {db => 1}), $pubsub,
'keyspace_unlisten without callback';
ok !$pubsub->{chans}{'__keyevent@1__:del'}, 'callback is removed';
-if ($ENV{TEST_KEA}) {
- my $redis = Mojo::Redis->new($ENV{TEST_ONLINE} || 'redis://localhost');
- my $kea = $redis->db->config(qw(get notify-keyspace-events))->[1];
+if ($ENV{TEST_KEA} && $ENV{TEST_ONLINE}) {
+ my $kea = $redis->db->config(qw(get notify-keyspace-events))->[1];
diag "config get notify-keyspace-events == $kea";
$redis->db->config(qw(set notify-keyspace-events KEA));
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-Redis-3.26/t/pubsub-reconnect.t
new/Mojo-Redis-3.27/t/pubsub-reconnect.t
--- old/Mojo-Redis-3.26/t/pubsub-reconnect.t 2019-02-08 10:00:38.000000000
+0100
+++ new/Mojo-Redis-3.27/t/pubsub-reconnect.t 2021-11-20 02:34:16.000000000
+0100
@@ -5,18 +5,19 @@
plan skip_all => 'TEST_ONLINE=redis://localhost' unless $ENV{TEST_ONLINE};
my $redis = Mojo::Redis->new($ENV{TEST_ONLINE});
-my $channel = "test:reconnect:$$";
+my $channel = "test:$$";
my $expected_reconnects = 3;
my ($pubsub_id, @before_connect, @disconnect, @err, @payloads, @reconnect);
note 'setup pubsub';
my $pubsub = $redis->pubsub;
+$pubsub->on(error => sub { shift; diag "[error] @_" });
$pubsub->reconnect_interval(0.3);
$pubsub->on(before_connect => sub { push @before_connect, $_[1] });
$pubsub->on(disconnect => sub { push @disconnect, $_[1] });
$pubsub->on(reconnect => sub { push @reconnect, $_[1] });
-$pubsub->on(reconnect => sub { shift->notify($channel => 'reconnected') });
+$pubsub->on(reconnect => sub { shift->notify($channel => 'reconnected')
});
$pubsub->on(
before_connect => sub {
@@ -35,17 +36,17 @@
);
note 'reconnect enabled';
-$pubsub->listen($channel => \&gather);
+$pubsub->listen($channel => \&gather);
$pubsub->listen("$channel:$_" => sub { }) for 1 .. 4;
Mojo::IOLoop->start;
plan skip_all => "CLIENT ID: @err" if @err;
is_deeply \@payloads, [qw(kill reconnected) x $expected_reconnects], 'got
payloads';
-is @before_connect, $expected_reconnects + 1, 'got before_connect events';
-is @reconnect, $expected_reconnects, 'got reconnect events';
-is @disconnect, $expected_reconnects, 'got disconnect events';
-isnt $before_connect[0], $before_connect[1], 'fresh connection';
+is @before_connect, $expected_reconnects + 1, 'got before_connect events';
+is @reconnect, $expected_reconnects, 'got reconnect events';
+is @disconnect, $expected_reconnects, 'got disconnect events';
+isnt $before_connect[0], $before_connect[1], 'fresh connection';
note 'reconnect disabled';
(@before_connect, @disconnect, @reconnect) = ();
@@ -59,13 +60,13 @@
Mojo::IOLoop->start;
is_deeply \@err, [], 'no errors';
is @before_connect + @reconnect, 0, 'got no before_connect or reconnect
events';
-is @disconnect, 1, 'got only disconnect event';
+is @disconnect, 1, 'got only disconnect event';
done_testing;
sub gather {
my ($pubsub, $payload) = @_;
- note "---payload=($payload)";
+ note "payload=($payload)";
push @payloads, $payload;
if ($payload eq 'kill') {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-Redis-3.26/t/pubsub.t
new/Mojo-Redis-3.27/t/pubsub.t
--- old/Mojo-Redis-3.26/t/pubsub.t 2020-10-02 03:20:40.000000000 +0200
+++ new/Mojo-Redis-3.27/t/pubsub.t 2021-11-20 02:37:47.000000000 +0100
@@ -13,6 +13,11 @@
my (@messages, @res);
memory_cycle_ok($redis, 'cycle ok for Mojo::Redis::PubSub');
+my @events;
+$pubsub->on(error => sub { shift; push @events, [error => @_] });
+$pubsub->on(psubscribe => sub { shift; push @events, [psubscribe => @_] });
+$pubsub->on(subscribe => sub { shift; push @events, [subscribe => @_] });
+
is ref($pubsub->listen("rtest:$$:1" => \&gather)), 'CODE', 'listen';
$pubsub->listen("rtest:$$:2" => \&gather);
note 'Waiting for subscriptions to be set up...';
@@ -35,7 +40,7 @@
$pubsub->numpat_p->then(sub { @res = @_ })->wait;
is_deeply $res[0], 0, 'numpat_p';
-is $pubsub->unlisten("rtest:$$:1"), $pubsub, 'unlisten';
+is $pubsub->unlisten("rtest:$$:1", \&gather), $pubsub, 'unlisten';
memory_cycle_ok($pubsub, 'cycle ok after unlisten');
$db->publish_p("rtest:$$:1" => 'nobody is listening to this');
@@ -44,6 +49,20 @@
Mojo::IOLoop->start;
is_deeply [sort @messages], ['message one', 'message two'], 'got messages' or
diag join ", ", @messages;
+note 'test listen patterns';
+@messages = ();
+$pubsub->listen("rtest:$$:*" => \&gather);
+Mojo::IOLoop->timer(
+ 0.2 => sub {
+ $pubsub->notify("rtest:$$:4" => 'message four');
+ $pubsub->notify("rtest:$$:5" => 'message five');
+ }
+);
+Mojo::IOLoop->start;
+
+is_deeply [sort @messages], ['message five', 'message four'], 'got messages'
or diag join ", ", @messages;
+$pubsub->unlisten("rtest:$$:*");
+
my $conn = $pubsub->connection;
is @{$conn->subscribers('response')}, 1, 'only one message subscriber';
@@ -65,6 +84,8 @@
Mojo::IOLoop->start;
is_deeply \@messages, [{some => 'data'}, 'just a string'], 'got json messages';
+is_deeply [sort { $a cmp $b } map { $_->[0] } @events], [qw(psubscribe
subscribe subscribe)], 'events';
+
done_testing;
sub gather {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-Redis-3.26/t/txn.t new/Mojo-Redis-3.27/t/txn.t
--- old/Mojo-Redis-3.26/t/txn.t 2019-02-08 07:52:12.000000000 +0100
+++ new/Mojo-Redis-3.27/t/txn.t 2021-11-20 02:03:23.000000000 +0100
@@ -27,8 +27,4 @@
undef $db;
is $redis->db->get($key), 1012, 'rollback when $db goes out of scope';
-$db = $redis->db;
-$db->multi_p($db->set_p($key => 1011), $db->set_p($key),
$db->get_p($key))->catch(sub { @res = @_ })->wait;
-like $res[0], qr{^ERR}, "invalid command: @res";
-
done_testing;