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
edd23f40
Commit
edd23f40
authored
Mar 28, 2014
by
Sven Franck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libs/jio: correctly set 404 on master/slave replicatestorage
parent
6e05fa15
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
ext/libs/jio/replicatestorage.js
ext/libs/jio/replicatestorage.js
+13
-13
No files found.
ext/libs/jio/replicatestorage.js
View file @
edd23f40
...
...
@@ -347,7 +347,6 @@
// setup master storage or all
if
(
master
!==
undefined
)
{
console
.
log
(
"
INTO MASTER
"
)
priority_list
[
0
]
=
success
(
command
.
storage
(
storages
[
master
]).
put
(
metadata
,
option
)
);
...
...
@@ -369,10 +368,10 @@
switch
(
true
)
{
// NOTE: this means if the master is 503, nothing will be saved on
// the slave? Is this what I would want?
// the slave? Is this what I would want?
YES
case
response
.
status
>=
500
:
//
command.error(response);
//
break;
command
.
error
(
response
);
break
;
// HACK: why does 204 return status code 0 on promises?
case
response
.
status
===
0
:
default
:
...
...
@@ -466,14 +465,16 @@
sequence
([
function
()
{
return
all
(
promise_list
);
},
function
(
answers
)
{
var
i
,
j
,
k
,
l
,
record
,
reply
,
rows
,
count
,
total
,
base
,
test
,
must_add
,
len
=
answers
.
length
;
var
i
,
j
,
k
,
l
,
record
,
reply
,
count
,
total
,
base
,
test
,
must_add
,
empty_reply
,
rows_len
,
rows
,
len
=
answers
.
length
;
// NOTE: every storage may return different records!
for
(
i
=
0
;
i
<
len
;
i
+=
1
)
{
reply
=
answers
[
i
];
if
(
reply
.
result
===
"
success
"
)
{
total
=
reply
.
data
.
total_rows
;
if
(
total
===
0
)
{
empty_reply
=
true
;
}
// loop records returned in response
for
(
j
=
0
;
j
<
total
;
j
+=
1
)
{
...
...
@@ -488,12 +489,11 @@
// loop records already in rows object
for
(
k
=
0
;
k
<
count
;
k
+=
1
)
{
base
=
rows
[
k
];
test
=
checksum
(
cleanClone
(
base
));
// record exists, test for coherence
if
(
base
.
id
===
record
.
id
)
{
must_add
=
undefined
;
if
(
test
!==
checksum
(
record
))
{
if
(
checksum
(
cleanClone
(
base
))
!==
checksum
(
record
))
{
if
(
!
base
.
_conflict_list
)
{
base
.
_conflict_list
=
[
base
];
}
...
...
@@ -504,7 +504,7 @@
must_add
=
true
;
}
}
// add missing record
s
// add missing record
if
(
must_add
)
{
// if on 2+ iteration, this means a 404 on previous storages
if
(
i
>
0
)
{
...
...
@@ -518,9 +518,9 @@
}
// if a storage returns rows = 0, make sure all records are labelled
if
(
total
===
0
)
{
rows
=
rows
||
[];
for
(
l
=
0
;
l
<
rows
.
length
;
l
+=
1
)
{
rows_len
=
(
rows
||
[]).
length
;
if
(
empty_reply
&&
rows_len
>
0
)
{
for
(
l
=
0
;
l
<
rows
_len
;
l
+=
1
)
{
rows
[
l
].
_missing
=
true
;
}
}
...
...
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