1

I'm working with G-WAN & mongoDB and I have a strange behavior. When I display my page, it looks ok. If I refresh it it will stop working after 5 or 6 refresh.

Here the code

// ============================================================================
// C servlet sample for the G-WAN Web Application Server (http://trustleap.ch/)
// ----------------------------------------------------------------------------
// mongodb.c: querying mongoDB from G-WAM
// ============================================================================

#pragma link "mongoc"
#pragma link "bson"

#include <mongo.h>
#include <bson.h>
#include "gwan.h" // G-WAN exported functions

int main(int argc, char *argv[])
{
  u64 start = getus();
  xbuf_t *reply = get_reply(argv);
  mongo conn[1];
  int status = mongo_client( conn, "localhost", 27017 );

  if( status != MONGO_OK ) {
    xbuf_xcat(reply, "ERROR MONGO %d", status);

  }

  int i = 0;
  for(i=0; i<2;i++) {
    bson b[1];
    bson_init( b );
    bson_append_new_oid( b, "_id" );
    bson_append_string( b, "name", "Joe" );
    bson_append_int( b, "age", 33 );
    bson_finish( b );
    mongo_insert( conn, "tutorial.people", b, NULL );
    bson_destroy( b );
  }

  xbuf_xcat(reply, "Hello Mongo !! %llU %d %d %llU micro seconds", getus(), status, i, (getus() - start));

  mongo_destroy(conn);
  return 200;
}
// ============================================================================
// End of Source Code
// ============================================================================

Nothing special in logs ...

[Fri Apr 26 06:36:57 2013 GMT] 127.0.0.1 "GET /?forum.c" 200 60 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:20.0) Gecko/20100101 Firefox/20.0"

Browser looks frozen, and the getus() value is not refreshed ... just like if a g-wan cached version was displayed ...

[UPDATED] I Think it's a G-WAN internal cache issue ... changing my url and adding some params to it refresh the page ...

Thank you for your help.

solisoft
  • 669
  • 4
  • 12

1 Answers1

0

The micro-cache lifespan is obviously too large in this release, but how to bypass it is well-documented.

Gil
  • 3,279
  • 1
  • 15
  • 25
  • As I said, changing url params works yes ... but strangely, something went wrong after some refresh and a long delay ... (more than 200ms) I wait around 1s before refreshing the web page – solisoft Apr 29 '13 at 06:54