Skip to content

Commit

Permalink
docstrings, moment import, fix log format
Browse files Browse the repository at this point in the history
  • Loading branch information
paulfitz committed Jul 3, 2024
1 parent 95b8134 commit 5f9ecdc
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 15 deletions.
2 changes: 1 addition & 1 deletion app/common/normalizedDateTimeString.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import moment from 'moment';
import moment from 'moment-timezone';

/**
* Output an ISO8601 format datetime string, with timezone.
Expand Down
3 changes: 2 additions & 1 deletion app/server/lib/ActiveDoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2505,7 +2505,8 @@ export class ActiveDoc extends EventEmitter {
snapshotProgress.lastWindowDoneAt : Date.now();
const delay = snapshotProgress.lastWindowStartedAt ?
lastWindowTime - snapshotProgress.lastWindowStartedAt : null;
this._log.debug(docSession, 'snapshot status', {
log.rawInfo('snapshot status', {
...this.getLogMeta(docSession),
...snapshotProgress,
lastChangeAt: normalizedDateTimeString(snapshotProgress.lastChangeAt),
lastWindowStartedAt: normalizedDateTimeString(snapshotProgress.lastWindowStartedAt),
Expand Down
32 changes: 19 additions & 13 deletions app/server/lib/IDocStorageManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,34 +79,40 @@ export class TrivialDocStorageManager implements IDocStorageManager {
* All information is within the lifetime of a doc worker, not global.
*/
export interface SnapshotProgress {
// The last time the document was marked as having changed.
/** The last time the document was marked as having changed. */
lastChangeAt?: number;

// The last time a save window started for the document (checking to see
// if it needs to be pushed, and pushing it if so, possibly waiting
// quite some time to bundle any other changes).
/**
* The last time a save window started for the document (checking to see
* if it needs to be pushed, and pushing it if so, possibly waiting
* quite some time to bundle any other changes).
*/
lastWindowStartedAt?: number;

// The last time the document was either pushed or determined to not
// actually need to be pushed, after having been marked as changed.
/**
* The last time the document was either pushed or determined to not
* actually need to be pushed, after having been marked as changed.
*/
lastWindowDoneAt?: number;

// Number of times the document was pushed.
/** Number of times the document was pushed. */
pushes: number;

// Number of times the document was not pushed because no change found.
/** Number of times the document was not pushed because no change found. */
skippedPushes: number;

// Number of times there was an error trying to push.
/** Number of times there was an error trying to push. */
errors: number;

// Number of times the document was marked as changed.
// Will generally be a lot greater than saves.
/**
* Number of times the document was marked as changed.
* Will generally be a lot greater than saves.
*/
changes: number;

// Number of times a save window was started.
/** Number of times a save window was started. */
windowsStarted: number;

// Number of times a save window was completed.
/** Number of times a save window was completed. */
windowsDone: number;
}

0 comments on commit 5f9ecdc

Please sign in to comment.