fails to capture all ressources

0 views
Skip to first unread message
Message has been deleted

frog

unread,
May 6, 2009, 11:12:34 AM5/6/09
to Gears Users
Hi,
I'm having problems with the method capture() of the ressource store.
Sometimes, when i want to capture an url or an array of url, I can't
capture all ressources, either I can't access all ressource, that is
to say that I don't have any callback or it stops in the middle of the
capture of an array without other messages.
I can show you my code where I use the method:

//////////////////////////////////////////////////////////////////////////
console.log('file to capture: ' + files);
console.log('begin capture');

store.capture(files, function(url, success, captureId){
console.log('captured: ' + url + ' ----success: ' + success +
'----captureId: ' + captureId);
});

//////////////////////////////////////////////////////////////////////////

and my Firebug Panel to show you what happens:

//////////////////////////////////////////////////////////////////////////

>create local server
>file to capture: http://...<URL1>, http://<URL2>, http://<URL3>, http://<URL4>,...
>begin capture
>END create Local Server
>captured: http://<URL1> ----success: true----captureId: 1
>captured: http://<URL2> ----success: true----captureId: 1

//////////////////////////////////////////////////////////////////////////

So, as you can see it stop at the middle without reasons, sometimes it
doesn't begin, sometimes it goes until the end of my array... I don't
understand what is happening.
I can't find a solution, I tried lot of things without success.
has anybody a solution?
thanks.

Loic

Michael Nordman

unread,
May 6, 2009, 1:13:38 PM5/6/09
to gears...@googlegroups.com
I think if the 'store' is garbage collected prior to capture
completion, pending captures are dropped. Is there an reference to the
'store' in the global scope? And if not, does adding one make a
difference?

frog

unread,
May 7, 2009, 5:15:33 AM5/7/09
to Gears Users
Hello,
I didn't think about this. But yes my 'store' is in the global scope.
I tried with the 'files' in the global scope too without any success.
in this way, i tried to declare the callback function separately like
this:
////////////////////////////////////////
function capture(){
store.capture(files, callbackCapture)
}

function callbackCapture(url, success, captureId){
console.log('captured: ' + url + ' ----success: ' + success +
'----captureId: ' + captureId);
}
//////////////////////////////////////
but it didn't work either.

An other thing, in my function when i capture I declare the store like
this:
function capture(){
try {
localServer = google.gears.factory.create('beta.localserver');
localServer.removeStore(STORE_NAME);
store = localServer.createStore(STORE_NAME);
}
catch (ex) {
console.log('Could not remove local server: ' + ex.message);
}
store.capture(files, callbackCapture)
}

Maybe the 'remove' and 'createStore' are not yet finished when the
capture begins...
So I tried to separate these 3 actions, using 3 buttons: one to say
"remove", an other one to say "create" and the last one to capture.
With this technique, I can't reproduce the problem ( for few tests i
did), it seems to wok well.
Any Idea?

Loic


On 6 mai, 19:13, Michael Nordman <micha...@google.com> wrote:
> I think if the 'store' is garbage collected prior to capture
> completion, pending captures are dropped. Is there an reference to the
> 'store' in the global scope? And if not, does adding one make a
> difference?
>

Eduard Martini

unread,
May 7, 2009, 5:43:10 AM5/7/09
to Gears Users
What if you are not using remove at all? just make a new store and
start capture, is working?

frog

unread,
May 7, 2009, 6:46:56 AM5/7/09
to Gears Users
nop, it's the same...

frog

unread,
May 7, 2009, 6:49:30 AM5/7/09
to Gears Users
nop, it's the same...

On 7 mai, 11:43, Eduard Martini <eduard.mart...@gmail.com> wrote:

Michael Nordman

unread,
May 7, 2009, 2:44:43 PM5/7/09
to gears...@googlegroups.com
Are there any code paths where you reassign to the 'store' global
variable after the capture has been initiated? If so, this will leave
the prior value subject to garbage collection.

James M

unread,
Jun 2, 2009, 5:46:33 PM6/2/09
to Gears Users
Hello,

Perhaps you could show us where you are declaring store. I don't see
it actually declared anywhere in your code. Where is "var store;"? I
had to declare that for it to work for me.

James

On May 6, 10:13 am, Michael Nordman <micha...@google.com> wrote:
> I think if the 'store' is garbage collected prior to capture
> completion, pending captures are dropped. Is there an reference to the
> 'store' in the global scope? And if not, does adding one make a
> difference?
>

frog

unread,
Jun 3, 2009, 3:01:34 AM6/3/09
to Gears Users
I declare my 'store' in the global scope.
Reply all
Reply to author
Forward
0 new messages