Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
funkwhale
funkwhale
Commits
14d5b0c6
Verified
Commit
14d5b0c6
authored
Feb 18, 2020
by
Eliot Berriot
Browse files
Revert to apline:3.11 to stay on Python 3.7 (3.8 has issues with channels)
parent
9a287646
Pipeline
#9672
canceled with stages
in 3 minutes and 11 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
api/Dockerfile
View file @
14d5b0c6
FROM
alpine:3.1
1
FROM
alpine:3.1
0
RUN
\
echo
'installing dependencies'
&&
\
...
...
api/config/settings/common.py
View file @
14d5b0c6
...
...
@@ -544,7 +544,7 @@ CHANNEL_LAYERS = {
}
CACHES
[
"default"
][
"OPTIONS"
]
=
{
"CLIENT_CLASS"
:
"
django_redis.client.Default
Client"
,
"CLIENT_CLASS"
:
"
funkwhale_api.common.cache.Redis
Client"
,
"IGNORE_EXCEPTIONS"
:
True
,
# mimics memcache behavior.
# http://niwinz.github.io/django-redis/latest/#_memcached_exceptions_behavior
}
...
...
api/funkwhale_api/common/cache.py
0 → 100644
View file @
14d5b0c6
import
logging
from
django_redis.client
import
default
logger
=
logging
.
getLogger
(
__name__
)
class
RedisClient
(
default
.
DefaultClient
):
def
get
(
self
,
key
,
default
=
None
,
version
=
None
,
client
=
None
):
try
:
return
super
().
get
(
key
,
default
=
None
,
version
=
None
,
client
=
None
)
except
ValueError
as
e
:
if
"unsupported pickle protocol"
in
str
(
e
):
# pickle deserialization error
logger
.
warn
(
"Error while deserializing pickle value from cache"
)
return
default
else
:
raise
def
get_many
(
self
,
*
args
,
**
kwargs
):
try
:
return
super
().
get_many
(
*
args
,
**
kwargs
)
except
ValueError
as
e
:
if
"unsupported pickle protocol"
in
str
(
e
):
# pickle deserialization error
logger
.
warn
(
"Error while deserializing pickle value from cache"
)
return
{}
else
:
raise
api/funkwhale_api/common/channels.py
View file @
14d5b0c6
...
...
@@ -8,6 +8,7 @@ from django.core.serializers.json import DjangoJSONEncoder
logger
=
logging
.
getLogger
(
__name__
)
channel_layer
=
get_channel_layer
()
group_add
=
async_to_sync
(
channel_layer
.
group_add
)
group_discard
=
async_to_sync
(
channel_layer
.
group_discard
)
def
group_send
(
group
,
event
):
...
...
api/funkwhale_api/common/consumers.py
View file @
14d5b0c6
...
...
@@ -14,7 +14,11 @@ class JsonAuthConsumer(JsonWebsocketConsumer):
def
accept
(
self
):
super
().
accept
()
for
group
in
self
.
groups
:
channels
.
group_add
(
group
,
self
.
channel_name
)
for
group
in
self
.
scope
[
"user"
].
get_channels_groups
():
groups
=
self
.
scope
[
"user"
].
get_channels_groups
()
+
self
.
groups
for
group
in
groups
:
channels
.
group_add
(
group
,
self
.
channel_name
)
def
disconnect
(
self
,
close_code
):
groups
=
self
.
scope
[
"user"
].
get_channels_groups
()
+
self
.
groups
for
group
in
groups
:
channels
.
group_discard
(
group
,
self
.
channel_name
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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