Permalink
Browse files

Trying to fix timing issue on Unix

  • Loading branch information...
1 parent ae0132a commit 0560cac12023c84f1bef8f6e47617157331df785 @JonathanWalsh committed May 17, 2011
Showing with 11 additions and 7 deletions.
  1. +6 −2 tag-main/src/com/granule/CachedBundle.java
  2. +5 −5 tag-main/src/com/granule/cache/FileCache.java
@@ -50,8 +50,8 @@
private static final String JAVASCRIPT_MIME = "application/x-javascript";
private static final String CSS_MIME = "text/css";
- private static final long ZIP_ERROR_COMPENSATION = 10000;//10 seconds
-
+ private static final long ZIP_ERROR_COMPENSATION = 10*1000;//10 seconds
+
public byte[] getBundleValue() {
return bundleValue;
}
@@ -274,5 +274,9 @@ public long getModifyDate() {
return modifyDate;
}
+ public void setModifyDate(long modifyDate) {
+ this.modifyDate=modifyDate;
+ }
+
private static final Logger logger = LoggerFactory.getLogger(CachedBundle.class);
}
@@ -110,18 +110,18 @@ private void saveBundle(String id, CachedBundle cs) {
try {
String filename = "/" + id + ".gzip."
+ (cs.isScript() ? "js" : "css");
-
+ File f = new File(cacheFolder + filename);
BufferedOutputStream bos = new BufferedOutputStream(
- new FileOutputStream(cacheFolder + filename));
+ new FileOutputStream(f));
try {
bos.write(cs.getBundleValue());
} finally {
bos.close();
}
- //File f = new File(cacheFolder + filename);
+ cs.setModifyDate(f.lastModified());
+
//f.setLastModified(System.currentTimeMillis());// cs.getModifyDate());
-
- String json = cs.getJSONString(id);
+ String json = cs.getJSONString(id);
catalog.write(json.getBytes("UTF-8"));
catalog.flush();
} catch (Exception e) {

0 comments on commit 0560cac

Please sign in to comment.