NYUCCL / psiTurk

An open platform for science on Amazon Mechanical Turk.
https://psiturk.org
MIT License
277 stars 140 forks source link

unique project/worker specific urls and browser caching #68

Closed gureckis closed 10 years ago

gureckis commented 10 years ago

I'm working on like 5 psiturk projects at once right now. When I switch between them the access URL stays the same (e.g., http://localhost/exp?). However often I have to reload a few times to update changes to html or css files that were cashed from my previous access to that URL (which was for a different project).

If possible might be nice if each project you were working on was accessed via a unique pre-fix to the path (that does nothing other than ensure uniqueness across project switches).

e.g., http://localhost/project1/exp? http://localhost/project2/exp?

This actually could be an issue in some cases.

Say researcher running two experiments. Day 1 it is project1, day 2 it is project2. Same worker does both. On day 2 worker's browser may have cached the stylesheet for project1 and thus not display project2 correctly without a manual refresh of the cache.

Above proposal will deal with this across projects at least. An even better approach but which might affect debugging is to put a random code in all urls (avoiding any browser caching at all).

jbmartin commented 10 years ago

Doesn't address your multiple experiments issue, but you can turn off caching via jQuery:

$.ajaxSetup({ 
  cache: false
});

Or directly with Flask headers.

gureckis commented 10 years ago

Cool, I think it makes sense to enforce this on all pages served via Flask because

  1. the expectation is that most people will only do task once and preload most content on first page visit (thus little benefit to caching)
  2. possible problems with caching across experiment versions, etc…

T

On Jan 27, 2014, at 2:50 AM, Jay B. Martin notifications@github.com wrote:

Doesn't address your multiple experiments issue, but you can turn off caching via jQuery:

$.ajaxSetup({ cache: false }); Or directly with Flask headers.

— Reply to this email directly or view it on GitHub.

jbmartin commented 10 years ago

Okay, I'll find all of the relevant routes and submit a patch. By the way, does turning off caching address your multiple experiments issue?

gureckis commented 10 years ago

yeah, I think it would

jbmartin commented 10 years ago

Patch 87f05be183d47228b8d4b0b1bb13a0ddccfbf688 should do the trick. Feel free to correct any routes I might have missed.

gureckis commented 10 years ago

I think I fixed the static route issue by turning off caching for all static files. I think that is what we probably want since users will want to preload images/html anyway.