diff options
author | Jonathan Abrahams <jonathan@mongodb.com> | 2016-03-09 12:17:50 -0500 |
---|---|---|
committer | Jonathan Abrahams <jonathan@mongodb.com> | 2016-03-09 12:18:14 -0500 |
commit | 4ae691e8edc87d0e3cfb633bb91c328426be007b (patch) | |
tree | 52079a593f54382ca13a2e741633eab1b6271893 /jstests/noPassthrough/lock_stats.js | |
parent | a025d43f3ce2efc1fb1282a718f5d286fa0a4dc1 (diff) | |
download | mongo-4ae691e8edc87d0e3cfb633bb91c328426be007b.tar.gz |
SERVER-22468 Format JS code with approved style in jstests/
Diffstat (limited to 'jstests/noPassthrough/lock_stats.js')
-rw-r--r-- | jstests/noPassthrough/lock_stats.js | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/jstests/noPassthrough/lock_stats.js b/jstests/noPassthrough/lock_stats.js index d32cd9f3af1..078a22ead2d 100644 --- a/jstests/noPassthrough/lock_stats.js +++ b/jstests/noPassthrough/lock_stats.js @@ -16,8 +16,10 @@ // Wait until we see somebody waiting to acquire the lock, defend against unset stats. assert.soon((function() { var stats = db.serverStatus().locks.Global; - if (!stats.acquireWaitCount || !stats.acquireWaitCount.W) return false; - if (!startStats.acquireWaitCount || !startStats.acquireWaitCount.W) return true; + if (!stats.acquireWaitCount || !stats.acquireWaitCount.W) + return false; + if (!startStats.acquireWaitCount || !startStats.acquireWaitCount.W) + return true; return stats.acquireWaitCount.W > startStats.acquireWaitCount.W; })); @@ -34,23 +36,29 @@ // The server was just started, so initial stats may be missing. if (!startStats.acquireWaitCount || !startStats.acquireWaitCount.W) { - startStats.acquireWaitCount = { W : 0 }; + startStats.acquireWaitCount = { + W: 0 + }; } if (!startStats.timeAcquiringMicros || !startStats.timeAcquiringMicros.W) { - startStats.timeAcquiringMicros = { W : 0 }; + startStats.timeAcquiringMicros = { + W: 0 + }; } var acquireWaitCount = endStats.acquireWaitCount.W - startStats.acquireWaitCount.W; - var blockedMillis = Math.floor((endStats.timeAcquiringMicros.W - - startStats.timeAcquiringMicros.W) / 1000); + var blockedMillis = + Math.floor((endStats.timeAcquiringMicros.W - startStats.timeAcquiringMicros.W) / 1000); // Require that no other commands run (and maybe acquire locks) in parallel. assert.eq(acquireWaitCount, 1, "other commands ran in parallel, can't check timing"); assert.gte(blockedMillis, minBlockedMillis, "reported time acquiring lock is too low"); assert.lte(blockedMillis, maxBlockedMillis, "reported time acquiring lock is too high"); - return({ blockedMillis: blockedMillis, - minBlockedMillis: minBlockedMillis, - maxBlockedMillis: maxBlockedMillis}); + return ({ + blockedMillis: blockedMillis, + minBlockedMillis: minBlockedMillis, + maxBlockedMillis: maxBlockedMillis + }); } var conn = MongoRunner.runMongod(); |