Permalink
Browse files

statement.close karuta

  • Loading branch information...
sorah committed Oct 22, 2017
1 parent 47cf95e commit fae2d21328fc9f71654cefcb0c4729af5240f363
Showing with 2 additions and 0 deletions.
  1. +2 −0 isubata/webapp/ruby/app.rb
@@ -149,6 +149,7 @@ def user
channel_ids.each do |ch|
statement = db.prepare('SELECT COUNT(*) as cnt FROM message WHERE channel_id = ?')
cnt = statement.execute(ch).first['cnt']
statement.close
redis.hset(redis_key_total_messages, ch, cnt)
end
@@ -273,6 +274,7 @@ def user
redis.hgetall(redis_key_lastreads(user_id)).each do |ch, last|
statement = db.prepare('SELECT COUNT(*) as cnt FROM message WHERE channel_id = ? AND ? < id')
unread = statement.execute(ch, last).first['cnt']
statement.close
rs[ch.to_s] = unread
end

0 comments on commit fae2d21

Please sign in to comment.