Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
ecommerce-ui
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
ecommerce-ui
Commits
2d5a5f89
Commit
2d5a5f89
authored
Feb 21, 2014
by
Sven Franck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed timeout because of errors not being caught in sequence
parent
24b9e1e7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
19 deletions
+17
-19
js/libs/jio/replicatestorage.js
js/libs/jio/replicatestorage.js
+17
-19
No files found.
js/libs/jio/replicatestorage.js
View file @
2d5a5f89
...
@@ -51,14 +51,16 @@
...
@@ -51,14 +51,16 @@
* @return {Object} clones object
* @return {Object} clones object
*/
*/
function
cleanClone
(
obj
)
{
function
cleanClone
(
obj
)
{
// NOTE: polyfill needed for IE8-
var
prop
,
r
=
{};
var
r
=
Object
.
create
(
obj
);
if
(
r
.
_missing
)
{
for
(
prop
in
obj
)
{
delete
r
.
_missing
;
if
(
obj
.
hasOwnProperty
(
prop
))
{
if
(
prop
.
charCodeAt
(
0
)
!==
95
||
prop
===
"
_id
"
)
{
r
[
prop
]
=
obj
[
prop
];
}
}
}
if
(
r
.
_conflict_list
)
{
delete
r
.
_conflict_list
;
}
}
return
r
;
return
r
;
};
};
...
@@ -242,14 +244,14 @@
...
@@ -242,14 +244,14 @@
promise_list
=
promise_list
.
slice
();
promise_list
=
promise_list
.
slice
();
return
new
Promise
(
function
(
resolve
,
reject
,
notify
)
{
return
new
Promise
(
function
(
resolve
,
reject
,
notify
)
{
var
index
,
doc
,
trace
,
version_list
,
count
,
error_count
,
tag
;
var
index
,
trace
,
conflict_list
,
count
,
error_count
,
tag
,
doc
;
version_list
=
[];
count
=
0
;
count
=
0
;
error_count
=
0
;
error_count
=
0
;
conflict_list
=
[];
tag
=
function
(
reply
)
{
tag
=
function
(
reply
)
{
if
(
version
_list
.
length
)
{
if
(
conflict
_list
.
length
)
{
reply
.
_conflict_list
=
version
_list
;
reply
.
_conflict_list
=
conflict
_list
;
}
}
if
(
error_count
)
{
if
(
error_count
)
{
reply
.
_missing
=
true
;
reply
.
_missing
=
true
;
...
@@ -259,19 +261,16 @@
...
@@ -259,19 +261,16 @@
function
resolver
(
answer
)
{
function
resolver
(
answer
)
{
if
(
trace
===
undefined
)
{
if
(
trace
===
undefined
)
{
trace
=
checksum
(
answer
);
doc
=
answer
;
doc
=
answer
;
trace
=
checksum
(
cleanClone
(
answer
.
data
));
}
else
{
}
else
{
if
(
trace
!==
checksum
(
answer
))
{
if
(
trace
!==
checksum
(
cleanClone
(
answer
.
data
)))
{
if
(
version
.
list
.
length
===
0
)
{
conflict_list
.
push
(
cleanClone
(
answer
.
data
));
version_list
.
push
(
doc
);
}
version_list
.
push
(
answer
);
}
}
}
}
count
+=
1
;
count
+=
1
;
if
(
count
===
length
)
{
if
(
count
===
length
)
{
return
resolve
(
tag
(
doc
));
return
resolve
(
tag
(
answer
));
}
}
}
}
function
rejecter
(
answer
)
{
function
rejecter
(
answer
)
{
...
@@ -292,7 +291,6 @@
...
@@ -292,7 +291,6 @@
});
});
};
};
}
}
for
(
index
=
0
;
index
<
length
;
index
+=
1
)
{
for
(
index
=
0
;
index
<
length
;
index
+=
1
)
{
promise_list
[
index
].
then
(
resolver
,
rejecter
,
notifier
(
index
));
promise_list
[
index
].
then
(
resolver
,
rejecter
,
notifier
(
index
));
}
}
...
...
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