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
package main | |
import ( | |
"fmt" | |
"net/http" | |
"log" | |
"redis" | |
"runtime" | |
"encoding/json" | |
"compress/zlib" |
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
Concurrency Level: 100 | |
Time taken for tests: 6.262829 seconds | |
Complete requests: 10000 | |
/*********************************************************** | |
Failed requests: 5028 | |
(Connect: 0, Length: 5028, Exceptions: 0) | |
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
package main | |
import ( | |
"bytes" | |
"compress/zlib" | |
"encoding/json" | |
"fmt" | |
"log" | |
"math" | |
"net/http" |
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
/** | |
* Appends a new item into the given users inbox | |
* | |
* @param userId The recipient of this message | |
* @param listName The name of the list being processed | |
* @param data The data to include with this message | |
* @param callback The callback to make when the list is fully processed. Passes error indicator and a buffer | |
*/ | |
this.appendInboxItem = function(userId, listName, data, callback){ | |
var client = this._getClientForKey(userId); |
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
/** | |
* Gets a collection of new inbox items, if any | |
* | |
* @param userId The user id of the user whos list is being processed | |
* @param listName The name of the list being processed | |
* @param playerInbox The players current inbox | |
* @param callback The callback to make when the list is fully processed. Passes error indic | |
*/ | |
this.getNewInboxItems = function(userId, listName, playerInbox, callback){ | |
var client = this._getClientForKey(userId); |
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
/** | |
* Acks all outstanding inbox messages | |
* | |
* @param userId The user id of the user whos list is being processed | |
* @param listName The name of the list being processed | |
* @param playerInbox The players current inbox | |
* @param callback The callback to make when the list is fully processed. Passes error indic | |
*/ | |
this.ackInboxItems = function(userId, listName, playerInbox, callback){ | |
this.ackInboxItemNext(userId, listName, playerInbox, 0, callback); |
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
/** | |
* Prune any inbox items that need to be deleted | |
* | |
* @param playerInbox the inbox to prune from | |
*/ | |
this.pruneReceivedInboxItems = function(playerInbox){ | |
var now = new Date().getTime(); | |
for(var messageId in playerInbox){ | |
var nextMessage = playerInbox[messageId]; | |
var age = now - nextMessage.receivedOn; |
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
/*! | |
* Inbox service. Responsible for sending messages and receiving new ones | |
*/ | |
function InboxService(){ | |
this.fetchNewItems = function(args, context, callback){ | |
var callResponse = {}; | |
ServiceLocator.PlayerManager.getOrCreatePlayer(context.UserId, context, function(player){ |
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
protected function wtf():void{ | |
var val:int = -3; | |
switch(val){ | |
case -3: | |
trace("woohoo"); | |
break; | |
default: | |
trace('wtf!'); | |
break; | |
} |
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
protected function works():void{ | |
var val:int = 3; | |
switch(val){ | |
case 3: | |
trace("woohoo"); | |
break; | |
default: | |
trace('wtf!'); | |
break; | |
} |
OlderNewer