Skip to content

Commit

Permalink
added archive_with_commit to cron page
Browse files Browse the repository at this point in the history
added return callback to ensure no callback failure if two archives are
made within the same second.
  • Loading branch information
hexparrot committed Aug 12, 2016
1 parent 14ec80e commit ab13105
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1333,6 +1333,7 @@ <h4 class="title" translate="CRONTAB_SCHEDULE"></h4>
<option translate="RESTART" value="restart"></option>
<option translate="CREATE_NEW_RESTORE_POINT" value="backup"></option>
<option translate="CREATE_NEW_ARCHIVE" value="archive"></option>
<option ng-show="current && servers[current].live_logs['logs/latest.log'].length" translate="COMMIT_THEN_CREATE_ARCHIVE" value="archive_with_commit"></option>
<option translate="SEND_TO_CONSOLE" value="stuff"></option>
</select>
</div>
Expand Down
6 changes: 3 additions & 3 deletions mineos.js
Original file line number Diff line number Diff line change
Expand Up @@ -1470,23 +1470,23 @@ mineos.mc = function(server_name, base_dir) {

var timeout = setTimeout(function(){
new_tail.unwatch();
callback(null, true); //default to true for unsupported server functionality fallback
return callback(null, true); //default to true for unsupported server functionality fallback
}, TIMEOUT_LENGTH);

new_tail.on('line', function(data) {
var match = data.match(/INFO]: Saving is already turned on/);
if (match) { //previously on, return true
clearTimeout(timeout);
new_tail.unwatch();
callback(null, true);
return callback(null, true);
}
var match = data.match(/INFO]: Turned on world auto-saving/);
if (match) { //previously off, return false
clearTimeout(timeout);
new_tail.unwatch();

self.stuff('save-off', function() { //reset initial state
callback(null, false); //return initial state
return callback(null, false); //return initial state
});
}
})
Expand Down

0 comments on commit ab13105

Please sign in to comment.