Merge pull request #292 from lbryio/284-uploads-hang
fix publishes hanging client side
This commit is contained in:
commit
2246cde1d7
6 changed files with 9 additions and 8 deletions
|
@ -10,7 +10,7 @@ module.exports = {
|
||||||
// publish the file
|
// publish the file
|
||||||
return lbryApi.publishClaim(publishParams)
|
return lbryApi.publishClaim(publishParams)
|
||||||
.then(tx => {
|
.then(tx => {
|
||||||
logger.info(`Successfully published ${fileName}`, tx);
|
logger.info(`Successfully published ${publishParams.name} ${fileName}`, tx);
|
||||||
publishResults = tx;
|
publishResults = tx;
|
||||||
// get the channel information
|
// get the channel information
|
||||||
if (publishParams.channel_name) {
|
if (publishParams.channel_name) {
|
||||||
|
@ -79,6 +79,7 @@ module.exports = {
|
||||||
resolve(publishResults); // resolve the promise with the result from lbryApi.publishClaim;
|
resolve(publishResults); // resolve the promise with the result from lbryApi.publishClaim;
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
logger.error('PUBLISH ERROR', error);
|
||||||
publishHelpers.deleteTemporaryFile(publishParams.file_path); // delete the local file
|
publishHelpers.deleteTemporaryFile(publishParams.file_path); // delete the local file
|
||||||
reject(error);
|
reject(error);
|
||||||
});
|
});
|
||||||
|
|
|
@ -93,7 +93,6 @@ module.exports = (sequelize, { STRING, BOOLEAN, INTEGER, TEXT, DECIMAL }) => {
|
||||||
|
|
||||||
Certificate.associate = db => {
|
Certificate.associate = db => {
|
||||||
Certificate.belongsTo(db.Channel, {
|
Certificate.belongsTo(db.Channel, {
|
||||||
onDelete : 'cascade',
|
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
allowNull: true,
|
allowNull: true,
|
||||||
},
|
},
|
||||||
|
|
|
@ -234,7 +234,6 @@ module.exports = (sequelize, { STRING, BOOLEAN, INTEGER, TEXT, DECIMAL }) => {
|
||||||
|
|
||||||
Claim.associate = db => {
|
Claim.associate = db => {
|
||||||
Claim.belongsTo(db.File, {
|
Claim.belongsTo(db.File, {
|
||||||
onDelete : 'cascade',
|
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
allowNull: true,
|
allowNull: true,
|
||||||
},
|
},
|
||||||
|
|
|
@ -27,7 +27,6 @@ module.exports = (sequelize, { STRING, BOOLEAN, TEXT }) => {
|
||||||
|
|
||||||
Request.associate = db => {
|
Request.associate = db => {
|
||||||
Request.belongsTo(db.File, {
|
Request.belongsTo(db.File, {
|
||||||
onDelete : 'cascade',
|
|
||||||
foreignKey: {
|
foreignKey: {
|
||||||
allowNull: true,
|
allowNull: true,
|
||||||
},
|
},
|
||||||
|
|
|
@ -123,12 +123,14 @@ const publishFileFunctions = {
|
||||||
xhr.open("POST", uri, true);
|
xhr.open("POST", uri, true);
|
||||||
xhr.onreadystatechange = function() {
|
xhr.onreadystatechange = function() {
|
||||||
if (xhr.readyState == 4) {
|
if (xhr.readyState == 4) {
|
||||||
|
console.log('publish response:', xhr.response)
|
||||||
if (xhr.status == 200) {
|
if (xhr.status == 200) {
|
||||||
console.log('publish complete!');
|
console.log('publish complete!');
|
||||||
that.showFilePublishComplete(JSON.parse(xhr.response).message);
|
that.showFilePublishComplete(JSON.parse(xhr.response).message);
|
||||||
|
} else if (xhr.status == 502){
|
||||||
|
that.showFilePublishFailure('Spee.ch was not able to get a response from the LBRY network.');
|
||||||
} else {
|
} else {
|
||||||
console.log(xhr.response);
|
that.showFilePublishFailure(JSON.parse(xhr.response).message);
|
||||||
that.showFilePublishFailure(JSON.parse(xhr.response).message);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log('xhr.readyState', xhr.readyState, 'xhr.status', xhr.status);
|
console.log('xhr.readyState', xhr.readyState, 'xhr.status', xhr.status);
|
||||||
|
|
|
@ -134,6 +134,7 @@ module.exports = (app) => {
|
||||||
res.status(400).json({success: false, message: error.message});
|
res.status(400).json({success: false, message: error.message});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
logger.debug('publish req.files:', files);
|
||||||
// validate file, name, license, and nsfw
|
// validate file, name, license, and nsfw
|
||||||
file = files.file;
|
file = files.file;
|
||||||
fileName = file.path.substring(file.path.lastIndexOf('/') + 1);
|
fileName = file.path.substring(file.path.lastIndexOf('/') + 1);
|
||||||
|
|
Loading…
Reference in a new issue