Fixed two issues #2053 and #2202 (#2203)

* Fixed two issues #2053 and #2202

* Updated changelog, updated versions

* Updated core version
main
Boris Sekachev 5 years ago committed by GitHub
parent 8330015ac5
commit a93b4607c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -36,6 +36,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed Data is not getting cleared, even after deleting the Task from Django Admin App(<https://github.com/openvinotoolkit/cvat/issues/1925>) - Fixed Data is not getting cleared, even after deleting the Task from Django Admin App(<https://github.com/openvinotoolkit/cvat/issues/1925>)
- Fixed blinking message: "Some tasks have not been showed because they do not have any data" (<https://github.com/openvinotoolkit/cvat/pull/2200>) - Fixed blinking message: "Some tasks have not been showed because they do not have any data" (<https://github.com/openvinotoolkit/cvat/pull/2200>)
- Fixed case when a task with 0 jobs is shown as "Completed" in UI (<https://github.com/openvinotoolkit/cvat/pull/2200>) - Fixed case when a task with 0 jobs is shown as "Completed" in UI (<https://github.com/openvinotoolkit/cvat/pull/2200>)
- Fixed use case when UI throws exception: Cannot read property 'objectType' of undefined #2053 (<https://github.com/openvinotoolkit/cvat/pull/2203>)
- Fixed use case when logs could be saved twice or more times #2202 (<https://github.com/openvinotoolkit/cvat/pull/2203>)
### Security ### Security
- -

@ -1,6 +1,6 @@
{ {
"name": "cvat-core", "name": "cvat-core",
"version": "3.7.0", "version": "3.7.1",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

@ -1,6 +1,6 @@
{ {
"name": "cvat-core", "name": "cvat-core",
"version": "3.7.0", "version": "3.7.1",
"description": "Part of Computer Vision Tool which presents an interface for client-side integration", "description": "Part of Computer Vision Tool which presents an interface for client-side integration",
"main": "babel.config.js", "main": "babel.config.js",
"scripts": { "scripts": {

@ -196,7 +196,7 @@ class LogWithExceptionInfo extends Log {
dump() { dump() {
let body = super.dump(); let body = super.dump();
const payload = body.payload; const { payload } = body;
const client = detect(); const client = detect();
body = { body = {
...body, ...body,

@ -14,6 +14,12 @@ const { LogType } = require('./enums');
const WORKING_TIME_THRESHOLD = 100000; // ms, 1.66 min const WORKING_TIME_THRESHOLD = 100000; // ms, 1.66 min
function sleep(ms) {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
}
class LoggerStorage { class LoggerStorage {
constructor() { constructor() {
this.clientID = Date.now().toString().substr(-6); this.clientID = Date.now().toString().substr(-6);
@ -22,6 +28,7 @@ class LoggerStorage {
this.collection = []; this.collection = [];
this.ignoreRules = {}; // by event this.ignoreRules = {}; // by event
this.isActiveChecker = null; this.isActiveChecker = null;
this.saving = false;
this.ignoreRules[LogType.zoomImage] = { this.ignoreRules[LogType.zoomImage] = {
lastLog: null, lastLog: null,
@ -146,6 +153,10 @@ LoggerStorage.prototype.log.implementation = function (logType, payload, wait) {
}; };
LoggerStorage.prototype.save.implementation = async function () { LoggerStorage.prototype.save.implementation = async function () {
while (this.saving) {
await sleep(100);
}
const collectionToSend = [...this.collection]; const collectionToSend = [...this.collection];
const lastLog = this.collection[this.collection.length - 1]; const lastLog = this.collection[this.collection.length - 1];
@ -164,14 +175,18 @@ LoggerStorage.prototype.save.implementation = async function () {
const userActivityLog = logFactory(LogType.sendUserActivity, logPayload); const userActivityLog = logFactory(LogType.sendUserActivity, logPayload);
collectionToSend.push(userActivityLog); collectionToSend.push(userActivityLog);
try {
this.saving = true;
await serverProxy.logs.save(collectionToSend.map((log) => log.dump())); await serverProxy.logs.save(collectionToSend.map((log) => log.dump()));
for (const rule of Object.values(this.ignoreRules)) { for (const rule of Object.values(this.ignoreRules)) {
rule.lastLog = null; rule.lastLog = null;
} }
this.collection = []; this.collection = [];
this.workingTime = 0; this.workingTime = 0;
this.lastLogTime = Date.now(); this.lastLogTime = Date.now();
} finally {
this.saving = false;
}
}; };
module.exports = new LoggerStorage(); module.exports = new LoggerStorage();

@ -1001,7 +1001,7 @@ export function getJobAsync(
export function saveAnnotationsAsync(sessionInstance: any): export function saveAnnotationsAsync(sessionInstance: any):
ThunkAction { ThunkAction {
return async (dispatch: ActionCreator<Dispatch>): Promise<void> => { return async (dispatch: ActionCreator<Dispatch>): Promise<void> => {
const { filters, frame, showAllInterpolationTracks } = receiveAnnotationsParameters(); const { filters, showAllInterpolationTracks } = receiveAnnotationsParameters();
dispatch({ dispatch({
type: AnnotationActionTypes.SAVE_ANNOTATIONS, type: AnnotationActionTypes.SAVE_ANNOTATIONS,
@ -1021,9 +1021,6 @@ ThunkAction {
}, },
}); });
}); });
const states = await sessionInstance
.annotations.get(frame, showAllInterpolationTracks, filters);
await saveJobEvent.close(); await saveJobEvent.close();
await sessionInstance.logger.log( await sessionInstance.logger.log(
LogType.sendTaskInfo, LogType.sendTaskInfo,
@ -1031,6 +1028,10 @@ ThunkAction {
); );
dispatch(saveLogsAsync()); dispatch(saveLogsAsync());
const { frame } = receiveAnnotationsParameters();
const states = await sessionInstance
.annotations.get(frame, showAllInterpolationTracks, filters);
dispatch({ dispatch({
type: AnnotationActionTypes.SAVE_ANNOTATIONS_SUCCESS, type: AnnotationActionTypes.SAVE_ANNOTATIONS_SUCCESS,
payload: { payload: {

Loading…
Cancel
Save