Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3344 version vizjson redis keys #3726

Merged
merged 14 commits into from
May 27, 2015
Merged

Conversation

rafatower
Copy link
Contributor

@juanignaciosl @Kartones please review

Not the best code ever but avoids duplication. If you see any major impediment I will postpone it till Monday and focus on 1st level cache of embeds, otherwise I'd like to have this in master asap to continue on top of it.

Thanks!

@Cartofante
Copy link
Collaborator

Frontend tests were OK 👍 (details)

def purge_redis_vizjson_cache
vizs = CartoDB::Visualization::Collection.new.fetch(user_id: self.id)
redis_http_keys = vizs.map{ |v| v.redis_vizjson_key(https_flag=false) }
redis_https_keys = vizs.map{ |v| v.redis_vizjson_key(https_flag=true) }
redis_vizjson_cache = CartoDB::Visualization::RedisVizjsonCache.new($tables_metadata)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you could move move most of this code to a simpler del(vizs) method inside RedisVizjsonCache.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to the simplification

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry but that is done for performance reasons when purging all the keys, which is the only purpose. Instead of sending 1 request per viz this sends just one per user, as requested bu the CTO 😄

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I supposed that (we don't want one redis connection per viz), but I think those lines fit better inside the redis cache class, since this looks like caching logic.

@Kartones
Copy link
Contributor

👍

…n-redis-keys

Conflicts:
	app/controllers/admin/visualizations_controller.rb
	app/models/visualization/member.rb
@Cartofante
Copy link
Collaborator

Frontend tests were OK 👍 (details)

@Cartofante
Copy link
Collaborator

Frontend tests were OK 👍 (details)

@Cartofante
Copy link
Collaborator

Frontend tests were OK 👍 (details)

@Cartofante
Copy link
Collaborator

Frontend tests were OK 👍 (details)

@Cartofante
Copy link
Collaborator

Frontend tests were OK 👍 (details)

@Cartofante
Copy link
Collaborator

Frontend tests were OK 👍 (details)

@Cartofante
Copy link
Collaborator

Frontend tests were OK 👍 (details)

@rafatower
Copy link
Contributor Author

@juanignaciosl & @Kartones test should pass now. Changes since the last time you reviewed it are basically updating with master, move the cache code to app/helpers and correct a couple of minor things.

If everything goes fine my plan is to release this tomorrow morning.

def purge_redis_vizjson_cache
vizs = CartoDB::Visualization::Collection.new.fetch(user_id: self.id)
redis_http_keys = vizs.map{ |v| v.redis_vizjson_key(https_flag=false) }
redis_https_keys = vizs.map{ |v| v.redis_vizjson_key(https_flag=true) }
redis_vizjson_cache = CartoDB::Visualization::RedisVizjsonCache.new()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like forcing User to know the internals of vizjson cache. For example, he must know about http-https versioning. I would extract the next 4 lines to a method inside RedisVizjsonCache and replace them with the call, something like redis_vizjson_cache.purge_visualizations_cache(vizs). Nevertheless I think we've already discussed about this, so if there's a god reason for keeping it just ignore this 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're right

@juanignaciosl
Copy link
Contributor

👍 (comment is just a matter of personal preferences, nothing relevant).

@Cartofante
Copy link
Collaborator

Frontend tests were OK 👍 (details)

@Cartofante
Copy link
Collaborator

Frontend tests were OK 👍 (details)

rafatower pushed a commit that referenced this pull request May 27, 2015
@rafatower rafatower merged commit ed7d00c into master May 27, 2015
@rafatower rafatower deleted the 3344-version-vizjson-redis-keys branch May 27, 2015 11:08
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.

4 participants