Skip to content

Commit

Permalink
Hotfixes for 3.2-b1
Browse files Browse the repository at this point in the history
Bug fix: Code replies after HTTP code 503 were not passed to codes
Bug fix: Making new directories did not work
  • Loading branch information
chrishamm committed Sep 16, 2020
1 parent 88826a0 commit 115b09e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "duetwebcontrol",
"version": "3.2.0-beta1+1",
"version": "3.2.0-beta1+2",
"repository": "github:chrishamm/DuetWebControl",
"homepage": "https://forum.duet3d.com/category/27/duet-web-control",
"license": "GPL-3.0",
Expand Down
23 changes: 12 additions & 11 deletions src/store/machine/connector/PollConnector.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,7 @@ export default class PollConnector extends BaseConnector {
if (retry < maxRetries) {
// RRF may have run out of output buffers. We usually get here when a code reply is blocking
if (retry === 0) {
that.lastSeq++;
that.getGCodeReply(that.lastSeq)
that.getGCodeReply()
.then(function() {
// Retry the original request when the code reply has been received
that.request(method, url, params, responseType, body, onProgress, timeout, cancellationToken, filename, retry + 1)
Expand Down Expand Up @@ -695,7 +694,6 @@ export default class PollConnector extends BaseConnector {
// Check if the G-code response needs to be polled
if (response.seq !== this.lastSeq) {
await this.getGCodeReply(response.seq);
this.lastSeq = response.seq;
}

// Check if the firmware rebooted
Expand Down Expand Up @@ -1023,21 +1021,24 @@ export default class PollConnector extends BaseConnector {
}
}

async getGCodeReply(seq) {
async getGCodeReply(seq = null) {
if (seq !== null) {
this.lastSeq = seq;
}

const response = await this.request('GET', 'rr_reply', this.requestTimeout, 'text');
const reply = response.trim();

if (!this.pendingCodes.length) {
// Forward generic messages to the machine module
this.dispatch('update', { messages: [new Message({ content: reply })] });
} else {
if (this.pendingCodes.length > 0) {
// Resolve pending code promises
this.pendingCodes.forEach(function(code) {
if (code.seq < seq) {
if (seq === null || code.seq < seq) {
code.resolve(reply);
}
}, this);
this.pendingCodes = this.pendingCodes.filter(code => code.seq >= seq);
this.pendingCodes = this.pendingCodes.filter(code => (seq !== null) && (code.seq >= seq));
} else if (reply !== '') {
// Forward generic messages to the machine module
this.dispatch('update', { messages: [new Message({ content: reply })] });
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/store/machine/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export default function(connector, pluginCacheFields, pluginSettingFields) {
// Make a new directroy path
// directory: Path of the directory
async makeDirectory(context, directory) {
await connector.makeDirectory({ machine: connector.hostname, directory });
await connector.makeDirectory(directory);
Root.$emit(Events.directoryCreated, { machine: connector.hostname, directory });
Root.$emit(Events.filesOrDirectoriesChanged, { machine: connector.hostname, files: [directory] });
},
Expand Down

0 comments on commit 115b09e

Please sign in to comment.