Skip to content

Commit

Permalink
applied comments
Browse files Browse the repository at this point in the history
  • Loading branch information
klakhov committed Mar 28, 2024
1 parent 03d59c4 commit f9ca01e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
3 changes: 2 additions & 1 deletion cvat-core/src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ Object.defineProperties(Logger.prototype.save, {
// potentially new events may be generated during saving
// that is why we add this.collection
this.collection = [...collectionToSend, ...this.collection];
throw error;

await Promise.reject(error);
} finally {
this.saving = false;
}
Expand Down
5 changes: 1 addition & 4 deletions cvat-ui/src/components/cvat-app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class CVATApplication extends React.PureComponent<CVATAppProps & RouteComponentP

public componentDidMount(): void {
const core = getCore();
const { history, location, user } = this.props;
const { history, location } = this.props;
const {
HEALTH_CHECK_RETRIES, HEALTH_CHECK_PERIOD, HEALTH_CHECK_REQUEST_TIMEOUT, SERVER_UNAVAILABLE_COMPONENT,
RESET_NOTIFICATIONS_PATHS,
Expand All @@ -149,9 +149,6 @@ class CVATApplication extends React.PureComponent<CVATAppProps & RouteComponentP
});

core.logger.configure(() => window.document.hasFocus, userActivityCallback);
if (user) {
EventRecorder.initSave();
}

core.config.onOrganizationChange = (newOrgId: number | null) => {
if (newOrgId === null) {
Expand Down
6 changes: 3 additions & 3 deletions cvat-ui/src/utils/event-recorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ class EventRecorder {
public initSave(): void {
if (this.#savingTimeout) return;
this.#savingTimeout = window.setTimeout(() => {
const save = (): void => {
const scheduleSave = (): void => {
this.#savingTimeout = null;
this.initSave();
};
core.logger.save()
.then(save)
.then(scheduleSave)
.catch((error) => {
if (error?.code === 401) {
this.cancelSave();
} else {
save();
scheduleSave();
}
});
}, CONTROLS_LOGS_INTERVAL);
Expand Down

0 comments on commit f9ca01e

Please sign in to comment.