-
Notifications
You must be signed in to change notification settings - Fork 722
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Uses a Waffle Sample to make a tunable percentage of requests (start with 1%) repeatedly hit the username API.
- Loading branch information
James Socol
committed
Apr 22, 2011
1 parent
5bf66d4
commit a6927e1
Showing
6 changed files
with
51 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/** | ||
* JavaScript load tests. | ||
* | ||
* Tests _must_ be behind some tunable flag or switch. | ||
*/ | ||
(function() { | ||
/** | ||
* Hit the usernames autocomplete API with a random request | ||
* every few seconds. This is tuned with the | ||
* 'usernames-test' sample in Waffle. | ||
*/ | ||
function loadTestUsernamesAPI() { | ||
if (waffle.sample("usernames-test")) { | ||
var chars = "abcdefghijklmnopqrstuvwxyz", | ||
ival, i = 0, MAX = 20; | ||
ival = setInterval(function() { | ||
if (i >= MAX) { | ||
clearInterval(ival); | ||
return; | ||
} | ||
i++; | ||
var a = Math.floor(Math.random() * chars.length), | ||
b = Math.floor(Math.random() * chars.length), | ||
prefix = chars.substring(a, a+1) + chars.substring(b, b+1); | ||
$.ajax( | ||
$("body").data("usernames-api"), | ||
{ | ||
cache: false, | ||
data: {"u": prefix}, | ||
error: function() { | ||
clearInterval(ival); | ||
} | ||
}); | ||
}, 20000); | ||
} | ||
} | ||
$(document).ready(loadTestUsernamesAPI); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,8 +18,5 @@ | |
}); | ||
} | ||
|
||
$(document).ready(function () { | ||
makeEmailsClickable(); | ||
}); | ||
|
||
$(document).ready(makeEmailsClickable); | ||
}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters