开发者

Flex URLRequest Timeout

开发者 https://www.devze.com 2022-12-29 15:01 出处:网络
I have a Flex program that gets a JS开发者_开发知识库ON array from a PHP script. The PHP script doesn\'t contain just a simple JSON array but it grabs data from Activecollab and do some work on the da

I have a Flex program that gets a JS开发者_开发知识库ON array from a PHP script. The PHP script doesn't contain just a simple JSON array but it grabs data from Activecollab and do some work on the data before encoding the data.

The first test involve a small JSON array that took a short time to encode by PHP. However, when I try to scale up the test, the Flash movie will crash trying to load the JSON data from PHP. There's no code difference between the tests, just the amount of data and amount of time it takes PHP to encode. Am I looking at a memory problem or a time out problem?

PS: When I call the PHP script in Firefox, it doesn't time out and still return a JSON array. It just took awhile to return the array.


I'm assuming that hitting your php service in a browser does not time out. If it does, then you need to change your php settings to allow the script to execute longer.

Otherwise you may try a different strategy altogether like this: Have flex call your php service and tell it to start data processing, have your php service return a token id to flex to use for polling. Have another php service track the progress of the processing (receiving the token for tracking the job). This second service will return a progress report with each request until the processing is done. When the processing is done, it returns the data on the next request.

Have php generate an id used to track the 'job' so that flex can poll and retrieve the data when the job is done. This will at least eliminate the wait time that Flex is dealing with while server-side processing happens.

Of course you'll need to store your pre-preocessed output server side somewhere while waiting for the request with the matching token. You'll also need a cleanup mechanism that clears this map/cache occasionally with a timeout.

You can check your memory usage on the client by using a flash memory profiler. Is your total memory usage going up a lot when you try to load the data?

0

精彩评论

暂无评论...
验证码 换一张
取 消