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
=== modified file 'bin/desktopcouch-service'
--- bin/desktopcouch-service 2009-08-05 01:00:33 +0000
+++ bin/desktopcouch-service 2009-08-11 14:44:34 +0000
@@ -44,11 +44,10 @@
44DBusGMainLoop(set_as_default=True)44DBusGMainLoop(set_as_default=True)
4545
46class PortAdvertiser(dbus.service.Object):46class PortAdvertiser(dbus.service.Object):
47 "Advertise the passed port number on the D-Bus Session bus"47 "Advertise the discovered port number on the D-Bus Session bus"
48 def __init__(self, port, death):48 def __init__(self, death):
49 bus_name = dbus.service.BusName("org.desktopcouch.CouchDB",49 bus_name = dbus.service.BusName("org.desktopcouch.CouchDB",
50 bus=dbus.SessionBus())50 bus=dbus.SessionBus())
51 self.port = int(port)
52 self.death = death51 self.death = death
53 dbus.service.Object.__init__(self, object_path="/", bus_name=bus_name)52 dbus.service.Object.__init__(self, object_path="/", bus_name=bus_name)
5453
@@ -56,7 +55,8 @@
56 in_signature='', out_signature='i')55 in_signature='', out_signature='i')
57 def getPort(self):56 def getPort(self):
58 "Exported method to return the port"57 "Exported method to return the port"
59 return self.port58 pid = desktopcouch.find_pid()
59 return int(desktopcouch.find_port(pid))
6060
61 @dbus.service.method(dbus_interface='org.desktopcouch.CouchDB',61 @dbus.service.method(dbus_interface='org.desktopcouch.CouchDB',
62 in_signature='', out_signature='')62 in_signature='', out_signature='')
@@ -65,10 +65,8 @@
65 self.death()65 self.death()
6666
67if __name__ == "__main__":67if __name__ == "__main__":
68 pid = desktopcouch.find_pid()
69 port = desktopcouch.find_port(pid)
7068
71 # Advertise the port69 # Advertise the port
72 mainloop = gobject.MainLoop()70 mainloop = gobject.MainLoop()
73 portAdvertiser = PortAdvertiser(port, mainloop.quit)71 portAdvertiser = PortAdvertiser(mainloop.quit)
74 mainloop.run()72 mainloop.run()

Subscribers

People subscribed via source and target branches