Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Operate
Environments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Matrix
Commits
74aaacf8
Commit
74aaacf8
authored
9 years ago
by
Mark Haines
Browse files
Options
Downloads
Patches
Plain Diff
Don't break when sizes or durations are given as integers
parent
c28f1d16
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
demo/start.sh
+3
-3
3 additions, 3 deletions
demo/start.sh
synapse/config/_base.py
+12
-9
12 additions, 9 deletions
synapse/config/_base.py
with
15 additions
and
12 deletions
demo/start.sh
+
3
−
3
View file @
74aaacf8
...
...
@@ -26,9 +26,9 @@ for port in 8080 8081 8082; do
https_port
=
$((
port
+
400
))
mkdir
-p
demo/
$port
pushd
demo/
$port
#
pushd demo/$port
rm
$DIR
/etc/
$port
.config
#
rm $DIR/etc/$port.config
python
-m
synapse.app.homeserver
\
--generate-config
\
-H
"localhost:
$https_port
"
\
...
...
@@ -39,7 +39,7 @@ for port in 8080 8081 8082; do
-D
\
-vv
\
popd
#
popd
done
cd
"
$CWD
"
This diff is collapsed.
Click to expand it.
synapse/config/_base.py
+
12
−
9
View file @
74aaacf8
...
...
@@ -27,30 +27,33 @@ class ConfigError(Exception):
class
Config
(
object
):
@staticmethod
def
parse_size
(
string
):
def
parse_size
(
value
):
if
isinstance
(
value
,
int
)
or
isinstance
(
value
,
long
):
return
value
sizes
=
{
"
K
"
:
1024
,
"
M
"
:
1024
*
1024
}
size
=
1
suffix
=
string
[
-
1
]
suffix
=
value
[
-
1
]
if
suffix
in
sizes
:
string
=
string
[:
-
1
]
value
=
value
[:
-
1
]
size
=
sizes
[
suffix
]
return
int
(
string
)
*
size
return
int
(
value
)
*
size
@staticmethod
def
parse_duration
(
string
):
def
parse_duration
(
value
):
if
isinstance
(
value
,
int
)
or
isinstance
(
value
,
long
):
return
value
second
=
1000
hour
=
60
*
60
*
second
day
=
24
*
hour
week
=
7
*
day
year
=
365
*
day
sizes
=
{
"
s
"
:
second
,
"
h
"
:
hour
,
"
d
"
:
day
,
"
w
"
:
week
,
"
y
"
:
year
}
size
=
1
suffix
=
string
[
-
1
]
suffix
=
value
[
-
1
]
if
suffix
in
sizes
:
string
=
string
[:
-
1
]
value
=
value
[:
-
1
]
size
=
sizes
[
suffix
]
return
int
(
string
)
*
size
return
int
(
value
)
*
size
@staticmethod
def
abspath
(
file_path
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment