Merge remote-tracking branch 'upstream/v2.5.x-release' into uploader-errors

This commit is contained in:
Ramón Souza 2022-08-23 09:34:25 -03:00
commit 4d82d76d4a
12 changed files with 51 additions and 37 deletions

View File

@ -24,7 +24,7 @@ trait PresentationPageCountErrorPubMsgHdlr {
liveMeeting.props.meetingProp.intId, msg.header.userId
)
val body = PresentationPageCountErrorEvtMsgBody(msg.body.podId, msg.body.messageKey, msg.body.code, msg.body.presentationId, msg.body.numberOfPages, msg.body.maxNumberPages, msg.body.presName)
val body = PresentationPageCountErrorEvtMsgBody(msg.body.podId, msg.body.messageKey, msg.body.code, msg.body.presentationId, msg.body.numberOfPages, msg.body.maxNumberPages, msg.body.presName, msg.body.temporaryPresentationId)
val event = PresentationPageCountErrorEvtMsg(header, body)
val msgEvent = BbbCommonEnvCoreMsg(envelope, event)
bus.outGW.send(msgEvent)

View File

@ -19,7 +19,7 @@ trait PresentationUploadTokenReqMsgHdlr extends RightsManagementTrait {
val envelope = BbbCoreEnvelope(PresentationUploadTokenPassRespMsg.NAME, routing)
val header = BbbClientMsgHeader(PresentationUploadTokenPassRespMsg.NAME, liveMeeting.props.meetingProp.intId, msg.header.userId)
val body = PresentationUploadTokenPassRespMsgBody(msg.body.podId, token, msg.body.filename, msg.body.tmpPresId)
val body = PresentationUploadTokenPassRespMsgBody(msg.body.podId, token, msg.body.filename, msg.body.temporaryPresentationId)
val event = PresentationUploadTokenPassRespMsg(header, body)
val msgEvent = BbbCommonEnvCoreMsg(envelope, event)
bus.outGW.send(msgEvent)

View File

@ -13,7 +13,7 @@ case class RemovePresentationPodPubMsgBody(podId: String)
object PresentationUploadTokenReqMsg { val NAME = "PresentationUploadTokenReqMsg" }
case class PresentationUploadTokenReqMsg(header: BbbClientMsgHeader, body: PresentationUploadTokenReqMsgBody) extends StandardMsg
case class PresentationUploadTokenReqMsgBody(podId: String, filename: String, tmpPresId: String)
case class PresentationUploadTokenReqMsgBody(podId: String, filename: String, temporaryPresentationId: String)
object GetAllPresentationPodsReqMsg { val NAME = "GetAllPresentationPodsReqMsg" }
case class GetAllPresentationPodsReqMsg(header: BbbClientMsgHeader, body: GetAllPresentationPodsReqMsgBody) extends StandardMsg
@ -65,7 +65,7 @@ case class PresentationPageCountErrorSysPubMsg(
body: PresentationPageCountErrorSysPubMsgBody
) extends StandardMsg
case class PresentationPageCountErrorSysPubMsgBody(podId: String, messageKey: String, code: String, presentationId: String,
numberOfPages: Int, maxNumberPages: Int, presName: String)
numberOfPages: Int, maxNumberPages: Int, presName: String, temporaryPresentationId: String)
object PdfConversionInvalidErrorSysPubMsg { val NAME = "PdfConversionInvalidErrorSysPubMsg" }
case class PdfConversionInvalidErrorSysPubMsg(
@ -182,7 +182,7 @@ case class PdfConversionInvalidErrorEvtMsgBody(podId: String, messageKey: String
object PresentationUploadTokenPassRespMsg { val NAME = "PresentationUploadTokenPassRespMsg" }
case class PresentationUploadTokenPassRespMsg(header: BbbClientMsgHeader, body: PresentationUploadTokenPassRespMsgBody) extends StandardMsg
case class PresentationUploadTokenPassRespMsgBody(podId: String, authzToken: String, filename: String, tmpPresId: String)
case class PresentationUploadTokenPassRespMsgBody(podId: String, authzToken: String, filename: String, temporaryPresentationId: String)
object PresentationUploadTokenFailRespMsg { val NAME = "PresentationUploadTokenFailRespMsg" }
case class PresentationUploadTokenFailRespMsg(header: BbbClientMsgHeader, body: PresentationUploadTokenFailRespMsgBody) extends StandardMsg
@ -194,7 +194,7 @@ case class PresentationConversionUpdateEvtMsgBody(podId: String, messageKey: Str
object PresentationPageCountErrorEvtMsg { val NAME = "PresentationPageCountErrorEvtMsg" }
case class PresentationPageCountErrorEvtMsg(header: BbbClientMsgHeader, body: PresentationPageCountErrorEvtMsgBody) extends BbbCoreMsg
case class PresentationPageCountErrorEvtMsgBody(podId: String, messageKey: String, code: String, presentationId: String, numberOfPages: Int, maxNumberPages: Int, presName: String)
case class PresentationPageCountErrorEvtMsgBody(podId: String, messageKey: String, code: String, presentationId: String, numberOfPages: Int, maxNumberPages: Int, presName: String, temporaryPresentationId: String)
object PresentationPageGeneratedEvtMsg { val NAME = "PresentationPageGeneratedEvtMsg" }
case class PresentationPageGeneratedEvtMsg(header: BbbClientMsgHeader, body: PresentationPageGeneratedEvtMsgBody) extends BbbCoreMsg

View File

@ -206,7 +206,8 @@ public class PresentationFileProcessor {
DocPageCountFailed progress = new DocPageCountFailed(pres.getPodId(), pres.getMeetingId(),
pres.getId(), pres.getId(),
pres.getName(), "notUsedYet", "notUsedYet",
pres.isDownloadable(), pres.isRemovable(), ConversionMessageConstants.PAGE_COUNT_FAILED_KEY);
pres.isDownloadable(), pres.isRemovable(), ConversionMessageConstants.PAGE_COUNT_FAILED_KEY,
pres.getTemporaryPresentationId());
notifier.sendDocConversionProgress(progress);
@ -232,7 +233,7 @@ public class PresentationFileProcessor {
pres.getId(), pres.getId(),
pres.getName(), "notUsedYet", "notUsedYet",
pres.isDownloadable(), pres.isRemovable(), ConversionMessageConstants.PAGE_COUNT_EXCEEDED_KEY,
e.getPageCount(), e.getMaxNumberOfPages());
e.getPageCount(), e.getMaxNumberOfPages(), pres.getTemporaryPresentationId());
notifier.sendDocConversionProgress(progress);
}

View File

@ -13,11 +13,12 @@ public class DocPageCountExceeded implements IDocConversionMsg {
public final String key;
public final Integer numPages;
public final Integer maxNumPages;
public final String temporaryPresentationId;
public DocPageCountExceeded(String podId, String meetingId, String presId, String presInstance,
String filename, String uploaderId, String authzToken,
Boolean downloadable, Boolean removable, String key,
Integer numPages, Integer maxNumPages) {
Integer numPages, Integer maxNumPages, String temporaryPresentationId) {
this.podId = podId;
this.meetingId = meetingId;
this.presId = presId;
@ -30,5 +31,6 @@ public class DocPageCountExceeded implements IDocConversionMsg {
this.key = key;
this.numPages = numPages;
this.maxNumPages = maxNumPages;
this.temporaryPresentationId = temporaryPresentationId;
}
}

View File

@ -11,10 +11,11 @@ public class DocPageCountFailed implements IDocConversionMsg {
public final Boolean downloadable;
public final Boolean removable;
public final String key;
public final String temporaryPresentationId;
public DocPageCountFailed(String podId, String meetingId, String presId, String presInstance,
String filename, String uploaderId, String authzToken,
Boolean downloadable, Boolean removable, String key) {
Boolean downloadable, Boolean removable, String key, String temporaryPresentationId) {
this.podId = podId;
this.meetingId = meetingId;
this.presId = presId;
@ -25,5 +26,6 @@ public class DocPageCountFailed implements IDocConversionMsg {
this.downloadable = downloadable;
this.removable = removable;
this.key = key;
this.temporaryPresentationId = temporaryPresentationId;
}
}

View File

@ -193,7 +193,7 @@ object MsgBuilder {
val header = BbbClientMsgHeader(PresentationPageCountErrorSysPubMsg.NAME, msg.meetingId, msg.authzToken)
val body = PresentationPageCountErrorSysPubMsgBody(podId = msg.podId, messageKey = msg.key,
code = msg.key, msg.presId, 0, 0, msg.filename)
code = msg.key, msg.presId, 0, 0, msg.filename, msg.temporaryPresentationId)
val req = PresentationPageCountErrorSysPubMsg(header, body)
BbbCommonEnvCoreMsg(envelope, req)
}
@ -204,7 +204,7 @@ object MsgBuilder {
val header = BbbClientMsgHeader(PresentationPageCountErrorSysPubMsg.NAME, msg.meetingId, msg.authzToken)
val body = PresentationPageCountErrorSysPubMsgBody(podId = msg.podId, messageKey = msg.key,
code = msg.key, msg.presId, msg.numPages.intValue(), msg.maxNumPages.intValue(), msg.filename)
code = msg.key, msg.presId, msg.numPages.intValue(), msg.maxNumPages.intValue(), msg.filename, msg.temporaryPresentationId)
val req = PresentationPageCountErrorSysPubMsg(header, body)
BbbCommonEnvCoreMsg(envelope, req)
}

View File

@ -7,20 +7,20 @@ export default function handlePresentationUploadTokenPass({ body, header }, meet
check(body, Object);
const { userId } = header;
const { podId, authzToken, filename, tmpPresId } = body;
const { podId, authzToken, filename, temporaryPresentationId } = body;
check(userId, String);
check(podId, String);
check(authzToken, String);
check(filename, String);
check(tmpPresId, String)
check(temporaryPresentationId, String)
const selector = {
meetingId,
podId,
userId,
filename,
tmpPresId,
temporaryPresentationId,
};
const modifier = {
@ -29,7 +29,7 @@ export default function handlePresentationUploadTokenPass({ body, header }, meet
userId,
filename,
authzToken,
tmpPresId,
temporaryPresentationId,
failed: false,
used: false,
};

View File

@ -3,7 +3,7 @@ import { check } from 'meteor/check';
import { extractCredentials } from '/imports/api/common/server/helpers';
import Logger from '/imports/startup/server/logger';
export default function requestPresentationUploadToken(podId, filename, tmpPresId) {
export default function requestPresentationUploadToken(podId, filename, temporaryPresentationId) {
const REDIS_CONFIG = Meteor.settings.private.redis;
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
const EVENT_NAME = 'PresentationUploadTokenReqMsg';
@ -15,12 +15,12 @@ export default function requestPresentationUploadToken(podId, filename, tmpPresI
check(requesterUserId, String);
check(podId, String);
check(filename, String);
check(tmpPresId, String);
check(temporaryPresentationId, String);
const payload = {
podId,
filename,
tmpPresId
temporaryPresentationId
};
RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);

View File

@ -4,7 +4,7 @@ import PresentationUploadToken from '/imports/api/presentation-upload-token';
import Logger from '/imports/startup/server/logger';
import AuthTokenValidation, { ValidationStates } from '/imports/api/auth-token-validation';
function presentationUploadToken(podId, filename, tmpPresId) {
function presentationUploadToken(podId, filename, temporaryPresentationId) {
const tokenValidation = AuthTokenValidation.findOne({ connectionId: this.connection.id });
if (!tokenValidation || tokenValidation.validationStatus !== ValidationStates.VALIDATED) {
@ -16,14 +16,14 @@ function presentationUploadToken(podId, filename, tmpPresId) {
check(podId, String);
check(filename, String);
check(tmpPresId, String);
check(temporaryPresentationId, String);
const selector = {
meetingId,
podId,
userId,
filename,
tmpPresId,
temporaryPresentationId,
};
Logger.debug('Publishing PresentationUploadToken', { meetingId, userId });

View File

@ -25,6 +25,7 @@ export default function handlePresentationConversionUpdate({ body }, meetingId)
const {
presentationId, podId, messageKey: status, presName: presentationName,
temporaryPresentationId
} = body;
check(meetingId, String);
@ -73,9 +74,17 @@ export default function handlePresentationConversionUpdate({ body }, meetingId)
id: presentationId ?? body.presentationToken,
};
const modifier = {
$set: Object.assign({ meetingId, podId }, statusModifier),
};
let modifier
if (temporaryPresentationId){
modifier = {
$set: Object.assign({ meetingId, podId, temporaryPresentationId, }, statusModifier),
};
} else {
modifier = {
$set: Object.assign({ meetingId, podId }, statusModifier),
};
}
try {
const { insertedId } = Presentations.upsert(selector, modifier);

View File

@ -68,7 +68,7 @@ const dispatchTogglePresentationDownloadable = (presentation, newState) => {
const observePresentationConversion = (
meetingId,
tmpPresId,
temporaryPresentationId,
onConversion,
) => new Promise((resolve) => {
const conversionTimeout = setTimeout(() => {
@ -89,7 +89,7 @@ const observePresentationConversion = (
query.observe({
added: (doc) => {
if (doc.temporaryPresentationId !== tmpPresId) return;
if (doc.temporaryPresentationId !== temporaryPresentationId) return;
if (doc.conversion.status === 'FILE_TOO_LARGE' || doc.conversion.status === 'UNSUPPORTED_DOCUMENT') {
onConversion(doc.conversion);
@ -98,7 +98,7 @@ const observePresentationConversion = (
}
},
changed: (newDoc) => {
if (newDoc.temporaryPresentationId !== tmpPresId) return;
if (newDoc.temporaryPresentationId !== temporaryPresentationId) return;
onConversion(newDoc.conversion);
@ -117,12 +117,12 @@ const observePresentationConversion = (
});
const requestPresentationUploadToken = (
tmpPresId,
temporaryPresentationId,
podId,
meetingId,
filename,
) => new Promise((resolve, reject) => {
makeCall('requestPresentationUploadToken', podId, filename, tmpPresId);
makeCall('requestPresentationUploadToken', podId, filename, temporaryPresentationId);
let computation = null;
const timeout = setTimeout(() => {
@ -132,13 +132,13 @@ const requestPresentationUploadToken = (
Tracker.autorun((c) => {
computation = c;
const sub = Meteor.subscribe('presentation-upload-token', podId, filename, tmpPresId);
const sub = Meteor.subscribe('presentation-upload-token', podId, filename, temporaryPresentationId);
if (!sub.ready()) return;
const PresentationToken = PresentationUploadToken.findOne({
podId,
meetingId,
tmpPresId,
temporaryPresentationId,
used: false,
});
@ -165,13 +165,13 @@ const uploadAndConvertPresentation = (
onProgress,
onConversion,
) => {
const tmpPresId = _.uniqueId(Random.id(20))
const temporaryPresentationId = _.uniqueId(Random.id(20))
const data = new FormData();
data.append('fileUpload', file);
data.append('conference', meetingId);
data.append('room', meetingId);
data.append('temporaryPresentationId', tmpPresId);
data.append('temporaryPresentationId', temporaryPresentationId);
// TODO: Currently the uploader is not related to a POD so the id is fixed to the default
data.append('pod_id', podId);
@ -183,12 +183,12 @@ const uploadAndConvertPresentation = (
body: data,
};
return requestPresentationUploadToken(tmpPresId, podId, meetingId, file.name)
return requestPresentationUploadToken(temporaryPresentationId, podId, meetingId, file.name)
.then((token) => {
makeCall('setUsedToken', token);
return futch(endpoint.replace('upload', `${token}/upload`), opts, onProgress);
})
.then(() => observePresentationConversion(meetingId, tmpPresId, onConversion))
.then(() => observePresentationConversion(meetingId, temporaryPresentationId, onConversion))
// Trap the error so we can have parallel upload
.catch((error) => {
logger.debug({
@ -197,7 +197,7 @@ const uploadAndConvertPresentation = (
error,
},
}, 'Generic presentation upload exception catcher');
observePresentationConversion(meetingId, tmpPresId, onConversion);
observePresentationConversion(meetingId, temporaryPresentationId, onConversion);
onUpload({ error: true, done: true, status: error.code });
return Promise.resolve();
});