Skip to content

Moves setting the app attribute to the _set_cache method#117

Open
vicentealencar wants to merge 1 commit intothadeusb:masterfrom
vicentealencar:master
Open

Moves setting the app attribute to the _set_cache method#117
vicentealencar wants to merge 1 commit intothadeusb:masterfrom
vicentealencar:master

Conversation

@vicentealencar
Copy link
Copy Markdown

Initializing a Cache instance with a None app and setting it later
via init_app causes the app attribute never to be set. This is fine for
most cases, since the cache is being set to the app extension. However,
it causes crashes when calling the Cache outside of a Flask context
(e.g.: spawned threads).

I found this while updating a project I was working on from an old Flask-Cache version to the most up-to-date. Our app was crashing when it spawned gevent threads in order to load data in parallel.

Initializing a Cache instance with a None app and setting it later
via init_app causes the app attribute never to be set. This is fine for
most cases, since the cache is being set to the app extension. However,
it causes crashes when calling the Cache outside of a Flask context
(e.g.: spawned threads).
@Fuyukai
Copy link
Copy Markdown

Fuyukai commented Aug 23, 2015

Hi there, I've merged this in my fork of the repository at https://github.com/SkierPGP/flask-cache

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants