• R/O
  • HTTP
  • SSH
  • HTTPS

shogi-server: コミット

shogi-server source


コミットメタ情報

リビジョン8c17b8b4420d4228d0c099e33f6417410adb9256 (tree)
日時2017-09-03 14:39:13
作者Daigo Moriwaki <daigo@debi...>
コミッターDaigo Moriwaki

ログメッセージ

[shogi-server] Write game results in categorical files

The shogi-server now writes down game results in the following files,
depending on a game class:
- 00LIST: all games
- 00LIST.floodgate: floodgate games
- 00LIST.others: non-floodgate games
(Closes #37492)

変更サマリ

差分

--- a/changelog
+++ b/changelog
@@ -1,3 +1,13 @@
1+2017-09-03 Daigo Moriwaki <daigo at debian dot org>
2+
3+ * [shogi-server] Write game results in categorical files
4+ The shogi-server now writes down game results in the following
5+ files, depending on a game class:
6+ - 00LIST: all games
7+ - 00LIST.floodgate: floodgate games
8+ - 00LIST.others: non-floodgate games
9+ (Closes #37492)
10+
111 2017-09-02 Daigo Moriwaki <daigo at debian dot org>
212
313 * [shogi-server] Write more game results in record files
--- a/shogi_server/game_result.rb
+++ b/shogi_server/game_result.rb
@@ -37,7 +37,9 @@ end
3737 #
3838 class LoggingObserver
3939 def initialize
40- @logfile = File.join($league.dir, "00LIST")
40+ @logfile = File.join($league.dir, "00LIST")
41+ @logfile_floodgate = File.join($league.dir, "00LIST.floodgate")
42+ @logfile_others = File.join($league.dir, "00LIST.others")
4143 end
4244
4345 def update(game_result)
@@ -55,9 +57,18 @@ class LoggingObserver
5557 game_result.game.logfile,
5658 game_result.game.board.move_count]
5759 begin
60+ files = [@logfile]
61+ if League::Floodgate.game_name?(game_result.game.game_name)
62+ files << @logfile_floodgate
63+ else
64+ files << @logfile_others
65+ end
5866 # Note that this is proccessed in the gian lock.
59- File.open(@logfile, "a") do |f|
60- f << msg.join("\t") << "\n"
67+ str = msg.join("\t")
68+ files.each do |file|
69+ File.open(file, "a") do |f|
70+ f.puts str
71+ end
6172 end
6273 rescue => e
6374 # ignore
旧リポジトリブラウザで表示