-
Notifications
You must be signed in to change notification settings - Fork 24
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
Memcached is not handled correctly #43
Comments
Hi Chris, Thanks for reporting this issue. Unfortunately I am afraid I cannot work on Regards, On Tue, Apr 3, 2012 at 9:12 PM, tazmaniax <
|
Hi Green, I'm going to have look into it now but I'm struggling with the new Mavenised version of the code and getting it to build in Eclipse - unfortunately I'm not too familiar with Maven. I have the core and play projects as two separate projects in my workspace now with the latest code from github. In the core module I did right click on the pom.xml and selected Run As -> Maven Install and got this:
However compiled classes were outputted to the 'target' directory I then did exactly the same to the play module, pom.xml -> right click -> Run As -> Maven Install and got this:
What happend to the good old simple Ant build? :) Any advice on how I can get the projects to build a module in Eclipse that I can then install locally into my Play project. |
You will need to first go into java/core and run mvn install On Wed, Apr 4, 2012 at 3:48 AM, tazmaniax <
|
I got something very similar running "mvn install" from the command line:
Here is the exception in target/surefire-reports/com.greenscriptool.MinimizerTest.txt:
|
hmm... something cause the unit test fail. My project can pass that ut. You On Wed, Apr 4, 2012 at 9:41 AM, tazmaniax <
|
Ok, I'm getting the test failure against the latest from your master branch (0069f70). What version are you building against? I'm looking at the test case now. To get it working in Eclipse I did "mvn eclipse:eclipse" - getting my Maven stripes :) |
I've stepped through the test in question and it looks like the test is no longer valid. The test is using com.greenscriptool.utils.FileCache which now uses the new logic to create the cache key based on the included resource so for the same set of resources the same cache key will always be generated regardless if the internal cache is enabled. I'm curious to know how the test is succeeding for you. I'm going to change the test to be assertTrue |
I am almost synchronized with the latest master. The only different is the c:\w_lgl>cd greenscript-1.2 c:\w_lgl\greenscript-1.2>git branch
c:\w_lgl\greenscript-1.2>git st On branch masterChanged but not updated:(use "git add/rm ..." to update what will be committed)(use "git checkout -- ..." to discard changes in workingdirectory) modified: java/core/pom.xmldeleted:java/play/app/views/tags/rythm/greenscript/closeTag_.html deleted: java/play/app/views/tags/rythm/greenscript/css.htmldeleted: java/play/app/views/tags/rythm/greenscript/gs_.htmldeleted:java/play/app/views/tags/rythm/greenscript/importCss.html deleted: java/play/app/views/tags/rythm/greenscript/js.htmldeleted: java/play/app/views/tags/rythm/greenscript/openTag_.htmldeleted: java/play/app/views/tags/rythm/greenscript/output_.htmlmodified: java/play/pom.xmlUntracked files:(use "git add ..." to include in what will be committed)java/play/app/rythm/push.batno changes added to commit (use "git add" and/or "git commit -a") On Wed, Apr 4, 2012 at 8:30 PM, tazmaniax <
|
Strange, I can pass the test: c:\w_lgl\greenscript-1.2\java\core>mvn test [INFO][INFO] Building GreenScript Core 1.2.8a [INFO][INFO] [INFO] --- maven-surefire-plugin:2.5:test (default-test) @ greenscript-core[INFO] Surefire report directory: T E S T SRunning com.greenscriptool.DependenceManagerTest Results : Tests run: 11, Failures: 0, Errors: 0, Skipped: 0 [INFO][INFO] BUILD SUCCESS [INFO][INFO] Total time: 12.923s [INFO]On Wed, Apr 4, 2012 at 8:57 PM, tazmaniax <
|
On a side note I had to remove many if not all of the @OverRide annotations because they were giving me a compile error in Eclipse on implemented interface methods. @OverRide is only supposed to be for when overring a superclass method and not for implementing interface methods. Must be a compile option configured by Eclipse but I couldn't find it in the preferences. |
so Maven install is working and all the necessary jar files are produced but how do I generate the Play! module? I can see this assembly-dist.xml which has all of the instructions but I don't know to kick that off? cheers |
mvn package -Pdist The module will be generated in the target folder. On Wed, Apr 4, 2012 at 9:47 PM, tazmaniax <
|
The cache management is a bit confusing. There seems to be a both file cache and a memory cache both which can be configured independently and there are different places in the code which access these two caches in an inconsistent manner, e.g. GreenScriptPlugin.getInMemoryFileContent() always refers to the in-memory cache even if the minimizer was configured to have the in-memory disabled - not sure how that would work. Looks like it would more straight forward for a single cache implementation to be set on the Minimizer and that would be either a file or memory or whatever caching mechanism. Anyway I started to try and unravel this a bit but got scared off so to address my immediate problem with Memcached I've come up with this minimal change:
Now it looks like Memcached only serializes using toString() as that was the only part of BufferResource that was stored. As a result the return from the cache is a String which meant that I had to change IResourceLocator.locate(...) to return an Object rather than an IResource. This wasn't such a big deal as it's only called from GreenScriptPlugin.getInMemoryFileContent() which can deal with the return result as an Object - checks for existence and calls toString(). It's all a bit hacky but it works. So this is all working on my local dev machine and I'm not going to push to Heroku and see how it goes. Running the app in development mode the CSS is minimized and stored in the cache with each request. Is this the same in production mode? Hopefully not. |
Hi Green, Ignore the bit above about Memcached return a string version, that was my change. I've fixed it so it's back to returning an IResource (BufferResource) Just sent you a pull request. All tested on Heroku (using a cluster of two dynos) Running the app in development mode the CSS is minimized and stored in the cache with each request. Is this the same in production mode? Something aside, when I start the application on Heroku, the first request returns this:
|
Hi tazmaniax, Thanks for your effort to solve this problem. About "something aside", what is greenscript.js? Green On Thu, Apr 5, 2012 at 7:40 PM, tazmaniax <
|
No idea, not part of our app. Very strange. I've seen it only recently. |
Hey @tazmaniax have you solved the Heroku problem? I am facing the same. |
Hi Green,
Just turned on memcached for the first time as the Play! Cache implementation and immediately have a problem. Looking at GreenScriptPlugin.bufferLocator_.newBuffer(List resourceNames, String extension) it adds the buffer to cache before the buffer has actually been populated - the buffer is then subsequently populated. This might be fine with a pure single JVM memory solution but with memcached or any other distributed cache I suspect it won't work as it ends up just adding empty values to the cache.
My first impression is that Cache.set(..) in GreenScriptPlugin.bufferLocator_.newBuffer(...) needs to be moved out a new method, such as storeBuffer(BufferResource), and called separately at the end of Minimizer.minimize(List resourceNames) so buffer is stored in the Cache only once it has been populated. I know probably a few more things to be changed to accomodate this but that's the general gist.
I'll try and have a deeper look into what could be changed later today but I wanted to give you a heads up. I need this fixed asap because I have other code depending on memcached being configured as the Play! cache.
cheers,
Chris
The text was updated successfully, but these errors were encountered: