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

3722 embeds vizjson in redis #3733

Merged
merged 13 commits into from
May 22, 2015
Merged

3722 embeds vizjson in redis #3733

merged 13 commits into from
May 22, 2015

Conversation

rafatower
Copy link
Contributor

@javisantana @Kartones @juanignaciosl can you please review?

I wish I knew a bit more about rails internals and its "convention over configuration", I really had to struggle with headers and render in order to send the cached response.

@Cartofante
Copy link
Collaborator

Frontend tests were OK 👍 (details)

@Cartofante
Copy link
Collaborator

Frontend tests were OK 👍 (details)

format.html { render layout: 'application_public_visualization_layout' }
format.js { render 'embed_map', content_type: 'application/javascript' }
if @cached
response.headers = @cached[:headers]
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can't overwrite response.headers, since it might already have a value (a quick local check says (byebug) response.headers {"Access-Control-Allow-Origin"=>"*", "Access-Control-Allow-Methods"=>"*"}). Maybe a merge! will be fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, actually I see in the response it added two Cache-Control headers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The duplicate entry comes from holding both :"symbolized" and "plain string" keys

@juanignaciosl
Copy link
Contributor

👍 apart from the comments.

@Kartones
Copy link
Contributor

I would add a test (mocking the cache, but to see that works fine), but apart from that +1

@Cartofante
Copy link
Collaborator

Frontend tests were OK 👍 (details)

@Cartofante
Copy link
Collaborator

Frontend tests were OK 👍 (details)

@redis = redis_cache
end

def get(visualization_id)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe I'm over-thinking, but after a second thought, if Redis went down or there were a error or connection issue this would fail and it wouldn't fallback to normal rendering, maybe this class should have error handling: reporting it but not propagating the exception.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • varnish down => ok, serve through redis cache
  • varnish and redis down => we're f**ked
  • redis down => sets and invalidations would fail

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also needed for vizjson cache, maybe I will make a separate branch for that that will conflict a little with the branch refactoring it out of old and new models :S

Copy link
Contributor

Choose a reason for hiding this comment

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

if redis go down, don't worry, everything will go down

@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 22, 2015
@rafatower rafatower merged commit 5678648 into master May 22, 2015
@rafatower rafatower deleted the 3722-embeds-vizjson-in-redis branch May 22, 2015 13:52
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.

5 participants