passiomatic / coldsweat

Web RSS aggregator and reader compatible with the Fever API
MIT License
146 stars 21 forks source link

sqlite issue #14

Closed chrisbgp closed 11 years ago

chrisbgp commented 11 years ago

Syncing does not work automatically. Updating via refresh_feeds.py does work tho.

Have not tried mysql yet...

localhost - - [18/Jul/2013:11:29:16 +0000] 16543 ERROR Traceback (most recent call last):
  File "/var/coldsweat/coldsweat/app.py", line 189, in __call__
    app_iter = self.app(environ, start_response)

  File "/var/coldsweat/coldsweat/app.py", line 249, in __call__
    return self._initial(environ, start_response)

  File "/var/coldsweat/coldsweat/app.py", line 240, in _initial
    return self.app(environ, session_response)

  File "/var/coldsweat/coldsweat/app.py", line 71, in __call__
    r = view(ctx, *args)

  File "/var/coldsweat/coldsweat/fever.py", line 250, in endpoint
    handler(ctx.request, user, result)

  File "/var/coldsweat/coldsweat/fever.py", line 31, in feeds_command
    result.feeds = get_feeds_for_user(user)

  File "/var/coldsweat/coldsweat/fever.py", line 304, in get_feeds_for_user
    'favicon_id'          : feed.icon.id,

  File "/usr/local/lib/python2.7/dist-packages/peewee.py", line 610, in __get__
    return self.get_object_or_id(instance)

  File "/usr/local/lib/python2.7/dist-packages/peewee.py", line 601, in get_object_or_id
    obj = self.rel_model.get(self.rel_model._meta.primary_key==rel_id)

  File "/usr/local/lib/python2.7/dist-packages/peewee.py", line 2295, in get
    return sq.get()

  File "/usr/local/lib/python2.7/dist-packages/peewee.py", line 1609, in get
    return clone.execute().next()

  File "/usr/local/lib/python2.7/dist-packages/peewee.py", line 1131, in next
    obj = self.iterate()

  File "/usr/local/lib/python2.7/dist-packages/peewee.py", line 1115, in iterate
    row = self.cursor.fetchone()

ProgrammingError: Cannot operate on a closed database.
chrisbgp commented 11 years ago

Switching to mysql did not work either and gives me this error:

Exception _mysql_exceptions.ProgrammingError: ProgrammingError('closing a closed connection',) in <bound method SessionCache.__del__ of <coldsweat.session.SessionCache object at 0x2379110>> ignored
´´´
passiomatic commented 11 years ago

Syncing does not work automatically. Updating via refresh_feeds.py does work tho.

Indeed, that's the way it works. You should use cron or something similar to schedule feed refresh.

The exceptions you posted seem related to the new session code, which unfortunately is still largely untested. Now that I think about it: I should activate session management only for webviews and not for Fever API. I'll look into it this week-end.

Thanks for testing mysql, I didn't pay too much attention to it.

chrisbgp commented 11 years ago

Ah ok I thought syncing happened automatically inside the app. Updating via cron is fine for me.

Thanks for the help and making your project open source!

passiomatic commented 11 years ago

Ah ok I thought syncing happened automatically inside the app. Updating via cron is fine for me.

It makes sense for the client (Reeder) but refresh 100+ feeds takes some time (minutes) and so it isn't clear how this would affect the whole process. Does the client wait for it? It isn't documented in the Fever API, but I've found out how a "server refresh" is triggered: https://github.com/passiomatic/coldsweat/wiki#force-a-server-feed-refresh

So at least for now it's a no-no. :)

chrisbgp commented 11 years ago

Yes that is true. Especially on a Raspberry Pi ;-)

Otherwise it works great so far!

chrisbgp commented 11 years ago

sqlite works now after your commit. I think this can be closed.

passiomatic commented 11 years ago

Not sure what was causing your first sqlite error, I reviewed the session code refactored the connect/close logic. If it happens again please reopen the ticket.