Merge lp:~cmiller/desktopcouch/getport-at-call-time into lp:desktopcouch

Proposed by Chad Miller
Status: Merged
Approved by: Zachery Bir
Approved revision: 34
Merged at revision: not available
Proposed branch: lp:~cmiller/desktopcouch/getport-at-call-time
Merge into: lp:desktopcouch
Diff against target: None lines
To merge this branch: bzr merge lp:~cmiller/desktopcouch/getport-at-call-time
Reviewer Review Type Date Requested Status
Eric Casteleijn (community) Needs Information
Zachery Bir (community) Approve
Elliot Murphy (community) Approve
Review via email: mp+9976@code.launchpad.net

Commit message

Get the port at function-call time, instead of storing a port at
start-time and giving that back. The info can be stale, the old
way.

To post a comment you must log in.
Revision history for this message
Elliot Murphy (statik) wrote :

seems like a good change.

review: Approve
Revision history for this message
Zachery Bir (urbanape) wrote :

Yay. Caching is good, but only if you have a way to purge it.

review: Approve
Revision history for this message
Eric Casteleijn (thisfred) wrote :
Download full text (10.3 KiB)

See test run below. The error I get on any branch and even trunk, and I have no idea if it's because something is misconfigured on my system. What's worrying is that it seems the automatic starter seems to start several couchdb instances, which is bad. It does seem that there is more than one instance running after this test:

eric@thelog:~/canonical/desktopcouch/r-get-port$ ps uax | grep couchdb
eric 14858 0.0 0.0 1836 544 pts/2 S 11:36 0:00 /bin/sh -e /usr/bin/couchdb -c \"/etc/couchdb/default.ini\" -c \"/home/eric/.config/desktop-couch/desktop-couchdb.ini\" -b -r 0 -p /home/eric/.cache/desktop-couch/desktop-couchdb.pid -o /home/eric/.cache/desktop-couch/desktop-couchdb.stdout -e /home/eric/.cache/desktop-couch/desktop-couchdb.stderr -R
eric 14885 0.0 0.0 1836 324 pts/2 S 11:36 0:00 /bin/sh -e /usr/bin/couchdb -c \"/etc/couchdb/default.ini\" -c \"/home/eric/.config/desktop-couch/desktop-couchdb.ini\" -b -r 0 -p /home/eric/.cache/desktop-couch/desktop-couchdb.pid -o /home/eric/.cache/desktop-couch/desktop-couchdb.stdout -e /home/eric/.cache/desktop-couch/desktop-couchdb.stderr -R
eric 14886 0.1 0.2 64000 7656 pts/2 Sl 11:36 0:00 /usr/lib/erlang/erts-5.7.2/bin/beam.smp -Bd -K true -- -root /usr/lib/erlang -progname erl -- -home /home/eric -noshell -noinput -smp auto -sasl errlog_type error -pa /usr/lib/couchdb/erlang/lib/couch-0.9.0/ebin /usr/lib/couchdb/erlang/lib/mochiweb-r97/ebin /usr/lib/couchdb/erlang/lib/ibrowse-1.4.1/ebin -eval application:load(ibrowse) -eval application:load(crypto) -eval application:load(couch) -eval crypto:start() -eval ibrowse:start() -eval couch_server:start([ "/etc/couchdb/default.ini", "/home/eric/.config/desktop-couch/desktop-couchdb.ini"]), receive done -> done end. -pidfile /home/eric/.cache/desktop-couch/desktop-couchdb.pid -heart
eric 14930 0.0 0.0 1836 540 pts/2 S 11:36 0:00 /bin/sh -e /usr/bin/couchdb -c \"/etc/couchdb/default.ini\" -c \"/home/eric/.config/desktop-couch/desktop-couchdb.ini\" -b -r 0 -p /home/eric/.cache/desktop-couch/desktop-couchdb.pid -o /home/eric/.cache/desktop-couch/desktop-couchdb.stdout -e /home/eric/.cache/desktop-couch/desktop-couchdb.stderr -R
eric 14958 0.0 0.0 1836 320 pts/2 S 11:36 0:00 /bin/sh -e /usr/bin/couchdb -c \"/etc/couchdb/default.ini\" -c \"/home/eric/.config/desktop-couch/desktop-couchdb.ini\" -b -r 0 -p /home/eric/.cache/desktop-couch/desktop-couchdb.pid -o /home/eric/.cache/desktop-couch/desktop-couchdb.stdout -e /home/eric/.cache/desktop-couch/desktop-couchdb.stderr -R
eric 14959 0.1 0.2 64000 7656 pts/2 Sl 11:36 0:00 /usr/lib/erlang/erts-5.7.2/bin/beam.smp -Bd -K true -- -root /usr/lib/erlang -progname erl -- -home /home/eric -noshell -noinput -smp auto -sasl errlog_type error -pa /usr/lib/couchdb/erlang/lib/couch-0.9.0/ebin /usr/lib/couchdb/erlang/lib/mochiweb-r97/ebin /usr/lib/couchdb/erlang/lib/ibrowse-1.4.1/ebin -eval application:load(ibrowse) -eval application:load(crypto) -eval application:load(couch) -eval crypto:start() -eval ibrowse:start() -eval couch_server:start([ "/etc/couchdb/default.ini", "/home/eric/.config/desktop-couch/desktop-couchdb.ini"]), ...

review: Needs Information

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/desktopcouch-service'
2--- bin/desktopcouch-service 2009-08-05 01:00:33 +0000
3+++ bin/desktopcouch-service 2009-08-11 14:44:34 +0000
4@@ -44,11 +44,10 @@
5 DBusGMainLoop(set_as_default=True)
6
7 class PortAdvertiser(dbus.service.Object):
8- "Advertise the passed port number on the D-Bus Session bus"
9- def __init__(self, port, death):
10+ "Advertise the discovered port number on the D-Bus Session bus"
11+ def __init__(self, death):
12 bus_name = dbus.service.BusName("org.desktopcouch.CouchDB",
13 bus=dbus.SessionBus())
14- self.port = int(port)
15 self.death = death
16 dbus.service.Object.__init__(self, object_path="/", bus_name=bus_name)
17
18@@ -56,7 +55,8 @@
19 in_signature='', out_signature='i')
20 def getPort(self):
21 "Exported method to return the port"
22- return self.port
23+ pid = desktopcouch.find_pid()
24+ return int(desktopcouch.find_port(pid))
25
26 @dbus.service.method(dbus_interface='org.desktopcouch.CouchDB',
27 in_signature='', out_signature='')
28@@ -65,10 +65,8 @@
29 self.death()
30
31 if __name__ == "__main__":
32- pid = desktopcouch.find_pid()
33- port = desktopcouch.find_port(pid)
34
35 # Advertise the port
36 mainloop = gobject.MainLoop()
37- portAdvertiser = PortAdvertiser(port, mainloop.quit)
38+ portAdvertiser = PortAdvertiser(mainloop.quit)
39 mainloop.run()

Subscribers

People subscribed via source and target branches