Hi,

I have a WO app which allow user to upload photos and associate a sale
record for each uploaded photo.
The record contains the unique ID in postgresql, path of the uploaded files
and other metadata like who and when the file was uploaded.

And I have a page for administrator which lists all the records. For each
record, the app display it's ID, preview, and other metadata.

So it look like this:

========================
Preview: WOActiveImage {
    action = download;
    data = sale.thumbnail;
    mimeType = "image/png";
    style = "border: 1px solid black;";
}

Sales: WORepetition {
    item = sale;
    list = sales;
}

========================
    protected Sale sale;

    public NSArray sales() {
        NSArray sales =
EOUtilities.objectsForEntityNamed(theSession().defaultEditingContext(),
"Sale");

        /* Filter the array with some
EOQualifier.filteredArrayWithQualifier(sales,
EOQualifier), snip */

        EOSortOrdering sort = EOSortOrdering.sortOrderingWithKey("created",
EOSortOrdering.CompareDescending);
        return EOSortOrdering.sortedArrayUsingKeyOrderArray(sales, new
NSArray(sort));
    }

    public WOComponent download()
    {
        MyDownloader n = (MyDownloader)pageWithName("MyDownloader");
        n.setFile(sale.file());
        n.setFilename(sale.canonicalFileName());
        return n;
    }
========================

It worked with low traffic. However, when we have more and more uploading,
things went wrong. Sometimes I click the download link of, says, SaleID = x,
it didn't give me the file of SaleID = x. Instead, it returns the file of
SaleID = x - 1.

After investigating for a while, I realized that what may cause this
problem. The following is what I suspect:

First, I generate the admin page of current sale records.

After that, some user upload a new file and create a new sale record.

Because I didn't refresh my admin page so it didn't reflect the current
state of sale records. It didn't know the new sale record was inserted.
Hence it will give me the wrong

If this is the case, how can I avoid the problem? I use WO 5.3 on Tiger.

Regards,
yllan
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to