Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-ds-flatfs
Commits
4fa81d12
Commit
4fa81d12
authored
Jul 26, 2016
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement batching for leveldb
parent
9400d1f2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
flatfs.go
flatfs.go
+4
-4
No files found.
flatfs.go
View file @
4fa81d12
...
...
@@ -99,7 +99,7 @@ func (fs *Datastore) makePrefixDirNoSync(dir string) error {
return
nil
}
var
putMaxRetries
=
3
var
putMaxRetries
=
6
func
(
fs
*
Datastore
)
Put
(
key
datastore
.
Key
,
value
interface
{})
error
{
val
,
ok
:=
value
.
([]
byte
)
...
...
@@ -111,15 +111,15 @@ func (fs *Datastore) Put(key datastore.Key, value interface{}) error {
for
i
:=
0
;
i
<
putMaxRetries
;
i
++
{
err
=
fs
.
doPut
(
key
,
val
)
if
err
==
nil
{
re
turn
nil
b
re
ak
}
if
!
strings
.
Contains
(
err
.
Error
(),
"too many open files"
)
{
re
turn
err
b
re
ak
}
log
.
Errorf
(
"too many open files, retrying in %dms"
,
100
*
i
)
time
.
Sleep
(
time
.
Millisecond
*
100
*
time
.
Duration
(
i
))
time
.
Sleep
(
time
.
Millisecond
*
100
*
time
.
Duration
(
i
+
1
))
}
return
err
}
...
...
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