This repository was archived by the owner on Sep 12, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +24
-6
lines changed
Branch.Core.Game.Halo4/Api
Branch.Core.Game.HaloReach/Api Expand file tree Collapse file tree 5 files changed +24
-6
lines changed Original file line number Diff line number Diff line change 11using System ;
2+ using System . Web ;
23using System . Web . Mvc ;
34using Branch . App . Models ;
45
@@ -11,13 +12,13 @@ public class SearchController : Controller
1112 public ActionResult Index ( string q )
1213 {
1314 if ( String . IsNullOrEmpty ( q ) )
14- throw new ArgumentException ( "yo, query can't be null/empty" ) ;
15+ throw new HttpException ( 404 , "yo, query can't be null/empty" ) ;
1516
1617 // find halo 4 players
17- var halo4ServiceRecord = GlobalStorage . H4Manager . GetPlayerServiceRecord ( q ) ;
18+ var halo4ServiceRecord = GlobalStorage . H4Manager . GetPlayerServiceRecord ( q , true ) ;
1819
1920 // find halo reach players
20- var haloReachServiceRecord = GlobalStorage . HReachManager . GetPlayerServiceRecord ( q ) ;
21+ var haloReachServiceRecord = GlobalStorage . HReachManager . GetPlayerServiceRecord ( q , true ) ;
2122
2223 // le render le model le
2324 return View ( new SearchViewModel ( q , halo4ServiceRecord , haloReachServiceRecord ) ) ;
Original file line number Diff line number Diff line change 3333 <add name =" ExtensionlessUrlHandler-Integrated-4.0" path =" *." verb =" *" type =" System.Web.Handlers.TransferRequestHandler" preCondition =" integratedMode,runtimeVersionv4.0" />
3434 </handlers >
3535 </system .webServer>
36+ <system .net>
37+ <connectionManagement >
38+ <add address =" *" maxconnection =" 1000" />
39+ </connectionManagement >
40+ </system .net>
3641 <runtime >
3742 <assemblyBinding xmlns =" urn:schemas-microsoft-com:asm.v1" >
3843 <dependentAssembly >
Original file line number Diff line number Diff line change 99 <Setting name =" SendGridPass" />
1010 <Setting name =" SendGridTo" />
1111 <Setting name =" StorageConnectionString" />
12+ <Setting name =" SqlServerConnectionString" />
1213 <Setting name =" SpartanTokenApi" />
1314 </ConfigurationSettings >
1415 <LocalResources >
1516 </LocalResources >
1617 </WorkerRole >
17- <WebRole name =" Branch.App" vmsize =" Small " >
18+ <WebRole name =" Branch.App" vmsize =" Medium " >
1819 <Sites >
1920 <Site name =" Web" >
2021 <Bindings >
3334 <Setting name =" SendGridPass" />
3435 <Setting name =" SendGridTo" />
3536 <Setting name =" StorageConnectionString" />
37+ <Setting name =" SqlServerConnectionString" />
3638 <Setting name =" SpartanTokenApi" />
3739 </ConfigurationSettings >
3840 <LocalResources >
Original file line number Diff line number Diff line change @@ -135,8 +135,9 @@ public void GetChallenges()
135135 /// Gets a Players Halo 4 Service Record
136136 /// </summary>
137137 /// <param name="gamertag">The players Xbox 360 Gamertag.</param>
138+ /// <param name="takeCachedVersion">Tries to take the cached version. If no cached version is avaiable, gets from server.</param>
138139 /// <returns>The raw JSON of their Service Record</returns>
139- public ServiceRecord GetPlayerServiceRecord ( string gamertag )
140+ public ServiceRecord GetPlayerServiceRecord ( string gamertag , bool takeCachedVersion = false )
140141 {
141142 const BlobType blobType = BlobType . PlayerServiceRecord ;
142143 var escapedGamertag = EscapeGamertag ( gamertag ) ;
@@ -147,6 +148,10 @@ public ServiceRecord GetPlayerServiceRecord(string gamertag)
147148 // Check if blob exists & expire date
148149 if ( blobValidity . Item1 ) return blobValidity . Item2 ;
149150
151+ // Do we take the cached version?
152+ if ( takeCachedVersion && blobValidity . Item2 != null )
153+ return blobValidity . Item2 ;
154+
150155 // Try and get new blob
151156 var url = PopulateUrl ( UrlFromIds ( EndpointType . ServiceList , "GetServiceRecord" ) ,
152157 new Dictionary < string , string > { { "gamertag" , gamertag } } ) ;
Original file line number Diff line number Diff line change @@ -64,8 +64,9 @@ public void GetMetadata()
6464 /// Gets a Players Halo: Reach Service Record
6565 /// </summary>
6666 /// <param name="gamertag">The players Xbox 360 Gamertag.</param>
67+ /// <param name="takeCachedVersion">Tries to take the cached version. If no cached version is avaiable, gets from server.</param>
6768 /// <returns>Retuens a <see cref="ServiceRecord"/> model.</returns>
68- public ServiceRecord GetPlayerServiceRecord ( string gamertag )
69+ public ServiceRecord GetPlayerServiceRecord ( string gamertag , bool takeCachedVersion = false )
6970 {
7071 const BlobType blobType = BlobType . PlayerServiceRecord ;
7172 var escapedGamertag = EscapeGamertag ( gamertag ) ;
@@ -76,6 +77,10 @@ public ServiceRecord GetPlayerServiceRecord(string gamertag)
7677 // Check if blob exists & expire date
7778 if ( blobValidity . Item1 ) return blobValidity . Item2 ;
7879
80+ // Do we take the cached version?
81+ if ( takeCachedVersion && blobValidity . Item2 != null )
82+ return blobValidity . Item2 ;
83+
7984 // Try and get new blob
8085 var endpoint = String . Format ( "player/details/byplaylist/{0}/{1}" , ApiKey , gamertag ) ;
8186 var serviceRecordRaw = ValidateResponseAndGetRawText ( UnauthorizedRequest ( endpoint ) ) ;
You can’t perform that action at this time.
0 commit comments