Jérémy Van de Wyngaert jeremyvdw

View gist:0959e4dfe6e664f6a27f
1 2 3 4 5 6 7 8 9
2015-03-12T16:11:27.042875+00:00 app[outlet.1]: source=coliseum_integration ns=Outlet fn=event_received num=548 type=HailUpdated id=977207ee-c61c-844d-8dd6-c4f9408b0051 received=152
2015-03-12T16:11:27.177147+00:00 app[outlet.1]: #<NoMethodError: undefined method `bytesize' for nil:NilClass>
2015-03-12T16:11:27.197090+00:00 app[outlet.1]:
2015-03-12T16:11:27.197092+00:00 app[outlet.1]:
2015-03-12T16:11:27.197213+00:00 app[outlet.1]: /app/vendor/bundle/ruby/2.2.0/gems/beefcake-1.1.0.pre1/lib/beefcake/buffer/base.rb:86:in `length'
2015-03-12T16:11:27.197271+00:00 app[outlet.1]: /app/vendor/bundle/ruby/2.2.0/gems/beefcake-1.1.0.pre1/lib/beefcake.rb:174:in `decode'
2015-03-12T16:11:27.197307+00:00 app[outlet.1]: /app/vendor/bundle/ruby/2.2.0/gems/beefcake-1.1.0.pre1/lib/beefcake/buffer/base.rb:97:in `read'
2015-03-12T16:11:27.197355+00:00 app[outlet.1]: /app/vendor/bundle/ruby/2.2.0/gems/beefcake-1.1.0.pre1/lib/beefcake.rb:203:in `decode'
2015-03-12T16:11:27.197391+00:00 app[outlet.1]: /app/vendor/bundle/ruby/2.2
View gist:7583eec5c5a3ed3b1505

Promises/Futures

background

La ludification a introduit une pression globalement plus forte à de multiples endroits de la plateforme. Durant les opérations de scoring, étape essentielle du jeu, de nombreuses informations doivent être écrites pour mettre à jours les scores des joueurs, leurs statistiques, les statistiques internes à la plateforme, ainsi que d’autres données concernant l’état du joueur dans le jeu en cours.
Il s’agit d’une matrice importante d’informations: pour chaque joueur, chaque opération de scoring provoque au minimum 97 opération d’écritures en base de données, jusqu’à 120 dans certains cas, et au moins 3 opérations de lecture.
En moyenne, chaque match compte 180 opportunités de prédiction (GuessOpportunity), chacune de celle ci comporte au minimum 100 prédictions (Guess).

La figure suivante représente une partie des opérations de lecture/écriture lors du scoring d'une prédiction d'un joueur.

View gist:d6970ebfea4e3e0d9c30
1 2 3 4 5 6 7 8 9 10
# Holds the current point at any given moment
# set: the set we're in
# game: the game we're in
# point: the point we're in (aggregated)
#
# Ex:
# +----------+---+---+---+----+
# | Nadal* | 6 | 4 | 5 | 30 |
# +----------+---+---+---+----+ ==> Nadal is serving for: Point.new(3,8,4)
# | Djokovic | 4 | 6 | 2 | 15 |
View docker_cleanup
1 2 3 4 5
# delete all non-running container
docker ps -a | grep 'Exit' | awk '{print $1}' | xargs docker rm
 
# delete unused images
docker images | grep '<none>' | awk '{print $3}' | xargs docker rmi
View gist:32dd12a3363b41393f48
1 2 3 4 5 6 7 8 9 10
An exception occurred running /usta_recorder/vendor/bundle/rbx/2.1/bin/rackup:
stream closed (EOFError)
Backtrace:
IO(TCPSocket)#read_nonblock at kernel/common/io.rb:1891
Net::BufferedIO#rbuf_fill at /opt/rubies/rbx-2.2.7/gems/gems/rubysl-net-protocol-2.0.1/lib/rubysl/net/protocol/protocol.rb:153
Net::BufferedIO#readuntil at /opt/rubies/rbx-2.2.7/gems/gems/rubysl-net-protocol-2.0.1/lib/rubysl/net/protocol/protocol.rb:134
Net::BufferedIO#readline at /opt/rubies/rbx-2.2.7/gems/gems/rubysl-net-protocol-2.0.1/lib/rubysl/net/protocol/protocol.rb:144
Net::HTTPResponse.read_status_line at /opt/rubies/rbx-2.2.7/gems/gems/rubysl-net-http-2.0.4/lib/net/http/response.rb:39
Net::HTTPResponse.read_new at /opt/rubies/rbx-2.2.7/gems/gems/rubysl-net-http-2.0.4/lib/net/http/response.rb:28
{ } in Net::HTTP#transport_request at /opt/rubies/rbx-2.2.7/gems/gems/rubysl-net-http-2.0.4/lib/rubysl/net/http/http.rb:1407
View Rakefile
1 2 3 4 5 6 7 8 9 10
# List of environments and their heroku git remotes (id: 'remote_name')
HEROKU_ENVIRONMENTS = {
staging: 'staging-remote-name',
production: 'production-remote-name'
}
 
namespace :deploy do
# Create rake tasks to deploy on Heroku environments
# $ rake -T deploy
# rake deploy:production # Deploy to production
View gist:7351993
1 2 3 4 5 6 7 8 9 10
if [[ -e /usr/local/share/chruby ]]; then
# Load chruby
source '/usr/local/share/chruby/chruby.sh'
 
# Automatically switch rubies
source '/usr/local/share/chruby/auto.sh'
 
# Set a default ruby if a .ruby-version file exists in the home dir
if [[ -f ~/.ruby-version ]]; then
chruby $(cat ~/.ruby-version)
View gist:5055886
1 2 3 4 5 6 7 8 9 10
> db.players.find( { team_id: { $in: ["phi"] } }).sort({last_name: 1}).explain()
{
"cursor" : "BtreeCursor team_id_1",
"isMultiKey" : false,
"n" : 37,
"nscannedObjects" : 37,
"nscanned" : 37,
"nscannedObjectsAllPlans" : 74,
"nscannedAllPlans" : 74,
"scanAndOrder" : true,
View gist:3699810
1 2 3 4 5 6 7 8 9 10
jeremy:preplaysports-api/ (rbx-2.0.testing) (master✗) $ foreman start worker=10 [18:47:20]
18:47:37 worker.1 | started with pid 34890
18:47:37 worker.2 | started with pid 34891
18:47:37 worker.3 | started with pid 34892
18:47:37 worker.4 | started with pid 34893
18:47:37 worker.5 | started with pid 34894
18:47:37 worker.6 | started with pid 34895
18:47:37 worker.7 | started with pid 34896
18:47:37 worker.8 | started with pid 34897
18:47:37 worker.9 | started with pid 34898
View gist:3692550
1 2 3 4 5 6 7 8 9 10
Redis::TimeoutError: Connection timed out
 
vendor/bundle/ruby/1.9.1/bundler/gems/redis-rb-4f7eadc119ba/lib/redis/client.rb:198 • rescue in io
vendor/bundle/ruby/1.9.1/bundler/gems/redis-rb-4f7eadc119ba/lib/redis/client.rb:196 • io
vendor/bundle/ruby/1.9.1/bundler/gems/redis-rb-4f7eadc119ba/lib/redis/client.rb:204 • read
vendor/bundle/ruby/1.9.1/bundler/gems/redis-rb-4f7eadc119ba/lib/redis/client.rb:142 • block in call_pipelined
vendor/bundle/ruby/1.9.1/bundler/gems/redis-rb-4f7eadc119ba/lib/redis/client.rb:177 • block (2 levels) in process
vendor/bundle/ruby/1.9.1/bundler/gems/redis-rb-4f7eadc119ba/lib/redis/client.rb:281 • ensure_connected
vendor/bundle/ruby/1.9.1/bundler/gems/redis-rb-4f7eadc119ba/lib/redis/client.rb:167 • block in process
vendor/bundle/ruby/1.9.1/bundler/gems/redis-rb-4f7eadc119ba/lib/redis/client.rb:242 • logging
Something went wrong with that request. Please try again.