Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

count が何故か 2191 or 0 で固定されて集計されてしまう問題を修正 #49

Merged
merged 3 commits into from
Sep 5, 2020

Conversation

mizdra
Copy link
Member

@mizdra mizdra commented Sep 5, 2020

ref: #33

  • 何故か count が何故か 2191 or 0 で固定されて集計されてしまっている
  • これだと今のタイマーの残り時間が分からないので、ちゃんと取得できるようにしたい
  • 原因不明 & 手元で全く再現しないのでとりあえずそれっぽいパッチを当てて勘で直してみる

this.currentState = {
// NOTE: Vue の data は getter を使って構成されているので、プロパティにアクセスするタイミングによって値が変わってしまう。
// これでは集計上不都合なので、ここで一度 pure なオブジェクトに変換している。
this.currentState = JSON.parse(JSON.stringify({
Copy link
Member Author

Choose a reason for hiding this comment

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

Vueのobserverが悪さしているのかな〜と思って、送信するデータを丸ごと JSON.parse(JSON.stringify(...)) するようにしてみた

Comment on lines +85 to +86
// Infinity は JSON に変換できないので -1 として扱う
maxLoop: newState.configInUse?.maxLoop === Infinity ? -1 : (newState.configInUse?.maxLoop ?? this.currentState.configInUse.maxLoop),
Copy link
Member Author

Choose a reason for hiding this comment

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

ついでに無限ループがONだと集計の送信に失敗するバグがあったので直しておいた

@@ -160,7 +164,7 @@ class MemoryMeasurementScheduler {

const scheduleMeasurement = () => {
const interval = measurementInterval()
console.log('Scheduling memory measurement in ' + Math.round(interval / 1000) + ' seconds.')
console.log(`Scheduling memory measurement in ${Math.round(interval / 1000)} seconds (${new Date(Date.now() + interval).toLocaleString()}).`)
Copy link
Member Author

Choose a reason for hiding this comment

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

今はN秒後に performance.measureMemory が発火する、というログしかだしていないけど、これだと何時何分くらいに発火するのかパッと分からなくてデバッグ時に不便なので、ついでに時刻の形式で表示するようにしてみた。

@mizdra mizdra merged commit 1399f49 into master Sep 5, 2020
@mizdra mizdra deleted the fix-measure-count branch September 5, 2020 13:38
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.

1 participant