mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-12-06 17:27:59 +00:00
Merge pull request #531 from clark800/fix-pathfind-queue
Fix queueing of pathfind requests
This commit is contained in:
@@ -2150,12 +2150,16 @@ Remote.prototype.requestPathFindClose = function(callback) {
|
||||
const request = new Request(this, 'path_find');
|
||||
|
||||
request.message.subcommand = 'close';
|
||||
request.callback(callback);
|
||||
this._cur_path_find = null;
|
||||
if (this._queued_path_finds.length > 0) {
|
||||
const pathfind = this._queued_path_finds.shift();
|
||||
this.createPathFind(pathfind.options, pathfind.callback);
|
||||
}
|
||||
request.callback((error, data) => {
|
||||
this._cur_path_find = null;
|
||||
if (this._queued_path_finds.length > 0) {
|
||||
const pathfind = this._queued_path_finds.shift();
|
||||
this.createPathFind(pathfind.options, pathfind.callback);
|
||||
}
|
||||
if (callback) {
|
||||
callback(error, data);
|
||||
}
|
||||
});
|
||||
|
||||
return request;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user