Skip to content

Commit

Permalink
the request queue partial flushing seems to work (on directory change…
Browse files Browse the repository at this point in the history
…) but Request.Queue seems to have an issue with not really cleaning up the .requests object in there... :-S
  • Loading branch information
GerHobbelt committed Apr 30, 2011
1 parent b921dbc commit bf86019
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Assets/Css/Additions.css
Expand Up @@ -41,12 +41,12 @@ div.filemanager-dialog {
font-family: Tahoma, sans-serif;
font-size: 12px;
background: rgba(0, 0, 0, 0.8);

-o-border-radius: 4px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;

box-shadow: rgba(0, 0, 0, 0.3) 0 0 10px;
-moz-box-shadow: rgba(0, 0, 0, 0.3) 0 0 10px;
-webkit-box-shadow: rgba(0, 0, 0, 0.3) 0 0 10px;
Expand Down
29 changes: 22 additions & 7 deletions Source/FileManager.js
Expand Up @@ -141,32 +141,47 @@ var FileManager = new Class({
this.dir_gallery_click_timer = null;


var dbg_cnt = 0;

this.RequestQueue = new Request.Queue({
concurrent: 3, // 3 --> 75% max load on a quad core server
autoAdvance: true,
stopOnFailure: false,

onRequest: (function(){
this.diag.log('request queue: onRequest: ', arguments);
//this.diag.log('request queue: onRequest: ', arguments);
}).bind(this),

onComplete: (function(){
this.diag.log('request queue: onComplete: ', arguments);
onComplete: (function(name){
//this.diag.log('request queue: onComplete: ', arguments);

// clean out the item from the queue; doesn't seem to happen automatically :-(
var cnt = 0;
Object.each(this.RequestQueue.requests, function() {
cnt++;
});
// cut down on the number of reports:
if (Math.abs(cnt - dbg_cnt) >= 25)
{
this.diag.log('request queue: name counts: ', cnt, ', queue length: ', this.RequestQueue.queue.length);
dbg_cnt = cnt;
}

}).bind(this),

onCancel: (function(){
this.diag.log('request queue: onCancel: ', arguments);
}).bind(this),

onSuccess: (function(){
this.diag.log('request queue: onSuccess: ', arguments);
//this.diag.log('request queue: onSuccess: ', arguments);
}).bind(this),

onFailure: (function(){
onFailure: (function(name){
this.diag.log('request queue: onFailure: ', arguments);
}).bind(this),

onException: (function(){
onException: (function(name){
this.diag.log('request queue: onException: ', arguments);
}).bind(this)

Expand All @@ -184,7 +199,7 @@ var FileManager = new Class({
this.cancel(name);
this.removeRequest(name);

this.clear(name); // eek, a full table scan! yech.
this.clear(name); // eek, a full table scan! yech.
delete this.requests[name];
delete this.reqBinders[name];
}
Expand Down
4 changes: 2 additions & 2 deletions Source/Gallery.js
Expand Up @@ -257,8 +257,8 @@ FileManager.Gallery = new Class({
// determine how many images we can show next to one another:
var galWidthComp = 2; // 2px not accounted for in the Width calculation; without these the width slowly grows instead of 'jump' to fit one more/less image horizontally
var imgMarginWidth = 4; // 4px unaccounted for in the element width
var radiiCorr = 20; // correction for the radii in the FileManager container: looks better that way
var imgWidth = 84; // derived from current CSS; bad form to do it this way, but this is a good guess when there's no image in there yet.
var radiiCorr = 20; // correction for the radii in the FileManager container: looks better that way
var imgWidth = 84; // derived from current CSS; bad form to do it this way, but this is a good guess when there's no image in there yet.
var imgs = this.galleryContainer.getElements('li');
if (imgs && imgs[0])
{
Expand Down

0 comments on commit bf86019

Please sign in to comment.