• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

shogi-server source


Commit MetaInfo

Revision8c17b8b4420d4228d0c099e33f6417410adb9256 (tree)
Time2017-09-03 14:39:13
AuthorDaigo Moriwaki <daigo@debi...>
CommiterDaigo Moriwaki

Log Message

[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)

Change Summary

Incremental Difference

--- 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