Skip to content

refactor: Time Master#801

Merged
alvinhui merged 15 commits intorelease/0.18.0from
fix/time-master
Mar 4, 2021
Merged

refactor: Time Master#801
alvinhui merged 15 commits intorelease/0.18.0from
fix/time-master

Conversation

@alvinhui
Copy link
Copy Markdown
Contributor

@alvinhui alvinhui commented Mar 3, 2021

  • @iceworks/storage: 导出 storagePath CHANGLOG
  • @iceworks/logger: 新增该包,将日志落盘
  • Time Master:
    • 重构:独立 initViews 方法,用于初始化视窗,并将视窗相关的方法都移动到 views/index.ts
    • 重构:使用 @iceworks/logger 写日志
    • 重构:独立 utils/day,用于同步当前日期信息
    • 🚀 重构:playload 数据不落盘,存储到插件进程的内存中,执行速度更快且避免多进程抢占文件资源
    • 🚀 重构:编辑器不聚焦即发送 playload ,尽可能保证 playload 的实时性,避免当天的 playload 未及时发送但云端定时任务已运行导致的日结算数据不完整

@alvinhui alvinhui requested a review from fyangstudio March 3, 2021 04:55
@alvinhui alvinhui self-assigned this Mar 3, 2021
@alvinhui alvinhui changed the title [WIP]Refactor: Time Master Refactor: Time Master Mar 3, 2021
@alvinhui alvinhui changed the title Refactor: Time Master refactor: Time Master Mar 3, 2021
@codecov-io
Copy link
Copy Markdown

codecov-io commented Mar 3, 2021

Codecov Report

Merging #801 (1ed7ed5) into release/0.18.0 (49a1f5d) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@               Coverage Diff               @@
##           release/0.18.0     #801   +/-   ##
===============================================
  Coverage           57.14%   57.14%           
===============================================
  Files                   1        1           
  Lines                  70       70           
  Branches               15       15           
===============================================
  Hits                   40       40           
  Misses                 30       30           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 49a1f5d...1ed7ed5. Read the comment docs.

try {
await checkMidnight();
await Promise.all([saveDataToDisk(data), appendDataToPayload(data)]);
} finally {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里不会有错误 要 catch 吗

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里不 catch 错误,是有意为之。

import { storagePath as iceworksStoragePath } from '@iceworks/storage';
import { getDataFromSettingJson } from '@iceworks/common-service';
import { getNowDay } from './time';
import { getNowDay } from './day';
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

day 和 time 拆开以后,time 的定位不太明确了

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

day 是同步当前日期,time 是时间的工具类

Comment thread packages/logger/src/index.js Outdated
const { storagePath } = require('@iceworks/storage');
const FileTransport = require('./fileTransport');

function getLogger(namespace) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

createLogger 或者 直接 Logger 好一些?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

更名为了 createLogger

return day;
}

export function checkIsNewDay() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个看着 还是像时间工具方法 0 0

@alvinhui alvinhui merged commit 05c3cd0 into release/0.18.0 Mar 4, 2021
@delete-merged-branch delete-merged-branch Bot deleted the fix/time-master branch March 4, 2021 14:35
@alvinhui alvinhui mentioned this pull request Mar 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants