Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Arnaud Véron
slapos.core
Commits
9083228c
Commit
9083228c
authored
Aug 29, 2016
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_monitoring: correctly manage jio_storage on sync, prevent start of two sync at same time
parent
5ef80d01
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
13 deletions
+52
-13
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_sync_js.html
...mplateItem/web_page_module/gadget_monitoring_sync_js.html
+50
-11
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_sync_js.xml
...emplateItem/web_page_module/gadget_monitoring_sync_js.xml
+2
-2
No files found.
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_sync_js.html
View file @
9083228c
...
...
@@ -9,6 +9,7 @@
gadget_klass
.ready(function (g) {
g.props = {};
g.props.jio_storage_dict = {};
return g.getDeclaredGadget('jio_gadget')
.push(function (jio_gadget) {
g.props.jio_gadget = jio_gadget;
...
...
@@ -67,9 +68,36 @@
return error_message;
}
function getJioGadget(gadget, hash) {
return new RSVP.Queue()
.push(function () {
if (gadget.props.jio_storage_dict.hasOwnProperty(hash)) {
return gadget.props.jio_storage_dict[hash];
} else {
return gadget.declareGadget("gadget_monitoring_jio.html",
{
scope: hash
}
)
.push(function (jio_declared_gadget) {
gadget.props.jio_storage_dict[hash] = jio_declared_gadget;
return jio_declared_gadget;
});
}
});
}
function syncStorage(gadget, storage_dict, query) {
gadget.props.jio_gadget.createJio(storage_dict, true, query);
return gadget.props.jio_gadget.repair()
var hash;
//gadget.props.jio_gadget.createJio(storage_dict, true, query);
hash = rusha.digestFromString(storage_dict.title.replace(/\s*/g, "") +
'_' + storage_dict.sub_storage.type);
return getJioGadget(gadget, hash)
.push(function (jio_declared_gadget) {
jio_declared_gadget.createJio(storage_dict, true, query);
return jio_declared_gadget.repair();
})
.push(undefined, function (error) {
gadget.props.error_list.push({
storage_dict: storage_dict,
...
...
@@ -82,8 +110,12 @@
function updateStatus(gadget, storage_dict, status) {
var promise_list = [],
jio_gadget,
hash,
i;
return gadget.declareGadget("gadget_monitoring_jio.html")
hash = rusha.digestFromString(storage_dict.title.replace(/\s*/g, "") +
'_' + storage_dict.sub_storage.type);
return getJioGadget(gadget, hash)
.push(function (jio_declared_gadget) {
jio_gadget = jio_declared_gadget;
jio_gadget.createJio(storage_dict);
...
...
@@ -210,9 +242,7 @@
last_sync_time
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
if
(
options
.
now
)
{
return
gadget
.
setSetting
('
manual_sync_time
',
new
Date
().
getTime
());
}
return
gadget
.
setSetting
('
sync_start_time
',
new
Date
().
getTime
());
})
.
push
(
function
()
{
$(".
notifyjs-wrapper
").
remove
();
...
...
@@ -226,6 +256,7 @@
);
})
.
push
(
function
()
{
//
Get
all
configured
credentials
return
gadget
.
props
.
login_gadget
.
getUrlDict
();
})
.
push
(
undefined
,
function
()
{
...
...
@@ -270,6 +301,10 @@
console
.
log
("
Sync
monitoring
data
...");
return
RSVP
.
all
(
promise_list
);
})
.
push
(
undefined
,
function
(
error
)
{
console
.
log
(
error
);
return
;
})
.
push
(
function
()
{
//
Check
if
there
was
errors
and
retry
them
if
possible
var
error_size =
gadget.props.error_list.length,
...
...
@@ -298,6 +333,10 @@
}
return
RSVP
.
all
(
promise_list
);
})
.
push
(
undefined
,
function
(
error
)
{
console
.
log
(
error
);
return
;
})
.
push
(
function
()
{
last_sync_time =
new
Date
().
getTime
();
return
gadget
.
setSetting
('
latest_sync_time
',
last_sync_time
);
...
...
@@ -367,13 +406,13 @@
gadget.props.timer =
setTimeout(function(){
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
gadget
.
getSetting
('
manual_sync
_time
');
return
gadget
.
getSetting
('
sync_start
_time
');
})
.
push
(
function
(
manual
_timestamp
)
{
.
push
(
function
(
start
_timestamp
)
{
var
current_time =
new
Date
().
getTime
();
if
(
manual
_timestamp
!==
undefined
&&
current_time
-
gadget
.
props
.
timer_interval
<=
manual
_timestamp
)
{
//
There
was
a
manual
sync
don
'
t
start
a
new
sync
again
!
if
(
start
_timestamp
!==
undefined
&&
current_time
-
gadget
.
props
.
timer_interval
<=
start
_timestamp
)
{
//
There
was
a
recent
sync
don
'
t
start
a
new
sync
before
the
time_interval
!
return
;
}
return
syncAllStorage
();
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_sync_js.xml
View file @
9083228c
...
...
@@ -242,7 +242,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
95
2.63467.50835.5744
6
</string>
</value>
<value>
<string>
95
3.32835.32275.4080
6
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>
147
0152500.12
</float>
<float>
147
2247230.79
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
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