Skip to content

Commit

Permalink
Bugfix: It is simpler and less prone to error to set the name on the …
Browse files Browse the repository at this point in the history
…pg object.
  • Loading branch information
Ryan Smith committed Jun 15, 2013
1 parent 80a4e30 commit 40b4735
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.db
.ruby-version
.bundle
.rvmrc
Expand Down
5 changes: 1 addition & 4 deletions lib/queue_classic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ module QC
# You can use the APP_NAME to query for
# postgres related process information in the
# pg_stat_activity table.
if APP_NAME = ENV["QC_APP_NAME"] || "queue_classic"
Conn.execute("SET application_name = '#{APP_NAME}'")
end
APP_NAME = ENV["QC_APP_NAME"] || "queue_classic"

# Why do you want to change the table name?
# Just deal with the default OK?
Expand Down Expand Up @@ -102,5 +100,4 @@ def self.log(data)
puts(out) if ENV["DEBUG"]
return result
end

end
1 change: 1 addition & 0 deletions lib/queue_classic/conn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def connect
if conn.status != PGconn::CONNECTION_OK
log(:error => conn.error)
end
conn.exec("SET application_name = '#{QC::APP_NAME}'")
conn
end

Expand Down

0 comments on commit 40b4735

Please sign in to comment.