Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-shell
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-shell
Commits
5497af18
Commit
5497af18
authored
Aug 03, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'update-redis-rb-3.3.3' into 'master'
Bump redis-rb library to 3.3.3 See merge request !151
parents
980eb544
274bddcd
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
74 additions
and
16 deletions
+74
-16
Makefile
Makefile
+1
-1
lib/vendor/redis/lib/redis.rb
lib/vendor/redis/lib/redis.rb
+8
-3
lib/vendor/redis/lib/redis/client.rb
lib/vendor/redis/lib/redis/client.rb
+3
-3
lib/vendor/redis/lib/redis/connection/ruby.rb
lib/vendor/redis/lib/redis/connection/ruby.rb
+59
-6
lib/vendor/redis/lib/redis/distributed.rb
lib/vendor/redis/lib/redis/distributed.rb
+2
-2
lib/vendor/redis/lib/redis/version.rb
lib/vendor/redis/lib/redis/version.rb
+1
-1
No files found.
Makefile
View file @
5497af18
REDIS_RB_VERSION
=
v3.3.
0
REDIS_RB_VERSION
=
v3.3.
3
REDIS_RB_VENDOR_DIR
=
lib/vendor/redis
PWD
=
`
pwd
`
...
...
lib/vendor/redis/lib/redis.rb
View file @
5497af18
...
...
@@ -1336,13 +1336,18 @@ class Redis
end
end
# Remove and return
a
random member from a set.
# Remove and return
one or more
random member from a set.
#
# @param [String] key
# @return [String]
def
spop
(
key
)
# @param [Fixnum] count
def
spop
(
key
,
count
=
nil
)
synchronize
do
|
client
|
client
.
call
([
:spop
,
key
])
if
count
.
nil?
client
.
call
([
:spop
,
key
])
else
client
.
call
([
:spop
,
key
,
count
])
end
end
end
...
...
lib/vendor/redis/lib/redis/client.rb
View file @
5497af18
...
...
@@ -451,12 +451,12 @@ class Redis
case
options
[
:tcp_keepalive
]
when
Hash
[
:time
,
:intvl
,
:probes
].
each
do
|
key
|
unless
options
[
:tcp_keepalive
][
key
].
is_a?
(
Fixnum
)
raise
"Expected the
#{
key
.
inspect
}
key in :tcp_keepalive to be a
Fixnum
"
unless
options
[
:tcp_keepalive
][
key
].
is_a?
(
Integer
)
raise
"Expected the
#{
key
.
inspect
}
key in :tcp_keepalive to be a
n Integer
"
end
end
when
Fixnum
when
Integer
if
options
[
:tcp_keepalive
]
>=
60
options
[
:tcp_keepalive
]
=
{
:time
=>
options
[
:tcp_keepalive
]
-
20
,
:intvl
=>
10
,
:probes
=>
2
}
...
...
lib/vendor/redis/lib/redis/connection/ruby.rb
View file @
5497af18
...
...
@@ -10,6 +10,16 @@ rescue LoadError
# Not all systems have OpenSSL support
end
if
RUBY_VERSION
<
"1.9.3"
class
String
# Ruby 1.8.7 does not have byteslice, but it handles encodings differently anyway.
# We can simply slice the string, which is a byte array there.
def
byteslice
(
*
args
)
slice
(
*
args
)
end
end
end
class
Redis
module
Connection
module
SocketMixin
...
...
@@ -17,8 +27,13 @@ class Redis
CRLF
=
"
\r\n
"
.
freeze
# Exceptions raised during non-blocking I/O ops that require retrying the op
NBIO_EXCEPTIONS
=
[
Errno
::
EWOULDBLOCK
,
Errno
::
EAGAIN
]
NBIO_EXCEPTIONS
<<
IO
::
WaitReadable
if
RUBY_VERSION
>=
"1.9.3"
if
RUBY_VERSION
>=
"1.9.3"
NBIO_READ_EXCEPTIONS
=
[
IO
::
WaitReadable
]
NBIO_WRITE_EXCEPTIONS
=
[
IO
::
WaitWritable
]
else
NBIO_READ_EXCEPTIONS
=
[
Errno
::
EWOULDBLOCK
,
Errno
::
EAGAIN
]
NBIO_WRITE_EXCEPTIONS
=
[
Errno
::
EWOULDBLOCK
,
Errno
::
EAGAIN
]
end
def
initialize
(
*
args
)
super
(
*
args
)
...
...
@@ -68,21 +83,58 @@ class Redis
begin
read_nonblock
(
nbytes
)
rescue
*
NBIO_EXCEPTIONS
rescue
*
NBIO_
READ_
EXCEPTIONS
if
IO
.
select
([
self
],
nil
,
nil
,
@timeout
)
retry
else
raise
Redis
::
TimeoutError
end
rescue
*
NBIO_WRITE_EXCEPTIONS
if
IO
.
select
(
nil
,
[
self
],
nil
,
@timeout
)
retry
else
raise
Redis
::
TimeoutError
end
end
rescue
EOFError
raise
Errno
::
ECONNRESET
end
# UNIXSocket and TCPSocket don't support write timeouts
def
write
(
*
args
)
Timeout
.
timeout
(
@write_timeout
,
TimeoutError
)
{
super
}
def
_write_to_socket
(
data
)
begin
write_nonblock
(
data
)
rescue
*
NBIO_WRITE_EXCEPTIONS
if
IO
.
select
(
nil
,
[
self
],
nil
,
@write_timeout
)
retry
else
raise
Redis
::
TimeoutError
end
rescue
*
NBIO_READ_EXCEPTIONS
if
IO
.
select
([
self
],
nil
,
nil
,
@write_timeout
)
retry
else
raise
Redis
::
TimeoutError
end
end
rescue
EOFError
raise
Errno
::
ECONNRESET
end
def
write
(
data
)
return
super
(
data
)
unless
@write_timeout
length
=
data
.
bytesize
total_count
=
0
loop
do
count
=
_write_to_socket
(
data
)
total_count
+=
count
return
total_count
if
total_count
>=
length
data
=
data
.
byteslice
(
count
..-
1
)
end
end
end
...
...
@@ -255,6 +307,7 @@ class Redis
raise
ArgumentError
,
"SSL incompatible with unix sockets"
if
config
[
:ssl
]
sock
=
UNIXSocket
.
connect
(
config
[
:path
],
config
[
:connect_timeout
])
elsif
config
[
:scheme
]
==
"rediss"
||
config
[
:ssl
]
raise
ArgumentError
,
"This library does not support SSL on Ruby < 1.9"
if
RUBY_VERSION
<
"1.9.3"
sock
=
SSLSocket
.
connect
(
config
[
:host
],
config
[
:port
],
config
[
:connect_timeout
],
config
[
:ssl_params
])
else
sock
=
TCPSocket
.
connect
(
config
[
:host
],
config
[
:port
],
config
[
:connect_timeout
])
...
...
lib/vendor/redis/lib/redis/distributed.rb
View file @
5497af18
...
...
@@ -483,8 +483,8 @@ class Redis
end
# Remove and return a random member from a set.
def
spop
(
key
)
node_for
(
key
).
spop
(
key
)
def
spop
(
key
,
count
=
nil
)
node_for
(
key
).
spop
(
key
,
count
)
end
# Get a random member from a set.
...
...
lib/vendor/redis/lib/redis/version.rb
View file @
5497af18
class
Redis
VERSION
=
"3.3.
0
"
VERSION
=
"3.3.
3
"
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment