Opened 9 years ago

Closed 8 years ago

#369 closed defect (fixed)

Thread locally scoped gettext

Reported by: Christopher Allan Webber Owned by: Jakob Kramer
Priority: trivial Milestone: 0.3.1
Component: programming Keywords: bitesized
Cc: Parent Tickets:

Description (last modified by Christopher Allan Webber)

Currently mediagoblin is not threadsafe, but really the only reason
for this is mg\_globals.gettext which is set at the start of every
request. So if there are two threads running in parallel these
might get clobbered.

However python has some thread-local scoping:
`http://docs.python.org/library/threading.html#threading.local <http://docs.python.org/library/threading.html#threading.local>`_

We could probably use that. SQLAlchemy has some thread-scoped
session, so theoretically it uses this, or we could look at what it
does use:
`http://www.sqlalchemy.org/docs/orm/session.html#sqlalchemy.orm.scoped\_session <http://www.sqlalchemy.org/docs/orm/session.html#sqlalchemy.orm.scoped_session>`_

Not super high priority as preforking does work fine-ish, but would
be very nice to have.



Subtickets

Change History (6)

comment:1 Changed 9 years ago by Will Kahn-Greene

The original url for this bug was http://bugs.foocorp.net/issues/727 .

comment:2 Changed 8 years ago by Christopher Allan Webber

Description: modified (diff)
Milestone: 0.3.1

Marking for 0.3.1... would really like to see this happen and get rolled in.

comment:3 Changed 8 years ago by Christopher Allan Webber

Keywords: bitesized added

If someone wants to jump on this, I think it's a very feasible task. I've marked it as bitesized. Maybe not good for someone totally new to python, but for someone pretty new to mediagoblin it's a good task.

comment:4 Changed 8 years ago by Jakob Kramer

Owner: set to Jakob Kramer

comment:5 Changed 8 years ago by Jakob Kramer

Here is my patch: Patch.

comment:6 Changed 8 years ago by Christopher Allan Webber

Resolution: fixed
Status: acceptedclosed

I merged this. Thanks so much gandaro... it looks great!

Note: See TracTickets for help on using tickets.