Show
Ignore:
Timestamp:
08/04/09 03:17:43 (9 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1249355863 +0000
git-parent:

[dff003cf9927bcbcbc7fe474f73a76f0dbc78ec6]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1249355863 +0000
Message:

We change the init order to instantiate the queues and other plumbing before starting the IEP engine.
During the successful spawning of the IEP system we submit a blank record to the IEP queue.
The IEP queue now always requests a driver connection (even if the event is blank).
This causes the connection to be established upon startup.

We actually postpone the connection attempt by a second and in the event that we don't get one we schedule a new attempt one second in the future.

closes #161

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/stratcon_iep.c

    rdff003c r6f4687b  
    376376 
    377377static int 
     378setup_iep_connection_callback(eventer_t e, int mask, void *closure, 
     379                              struct timeval *now) { 
     380  stratcon_iep_line_processor(DS_OP_INSERT, NULL, NULL); 
     381  return 0; 
     382} 
     383 
     384static void 
     385setup_iep_connection_later(int seconds) { 
     386  eventer_t newe = eventer_alloc(); 
     387  gettimeofday(&newe->whence, NULL); 
     388  newe->whence.tv_sec += seconds; 
     389  newe->mask = EVENTER_TIMER; 
     390  newe->callback = setup_iep_connection_callback; 
     391  newe->closure = NULL; 
     392  eventer_add(newe); 
     393} 
     394 
     395static int 
    378396stratcon_iep_submitter(eventer_t e, int mask, void *closure, 
    379397                       struct timeval *now) { 
    380398  float age; 
    381399  struct iep_job_closure *job = closure; 
     400  struct iep_thread_driver *driver; 
    382401  /* We only play when it is an asynch event */ 
    383402  if(!(mask & EVENTER_ASYNCH_WORK)) return 0; 
     
    395414    return 0; 
    396415  } 
     416  driver = stratcon_iep_get_connection(); 
     417  if(!driver) setup_iep_connection_later(1); 
     418 
    397419  if(!job->line || job->line[0] == '\0') return 0; 
    398420 
     
    406428    if(job->doc_str) { 
    407429      /* Submit */ 
    408       struct iep_thread_driver *driver; 
    409       driver = stratcon_iep_get_connection(); 
    410430      if(driver && driver->pool && driver->connection) { 
    411431        apr_status_t rc; 
     
    654674  info = NULL; 
    655675 
     676  /* This will induce a stomp connection which will initialize esper */ 
     677  setup_iep_connection_later(1); 
     678 
    656679  return; 
    657680 
     
    680703  if(!noit_iep) noit_iep = noit_error; 
    681704 
    682   start_iep_daemon(); 
    683  
    684705  eventer_name_callback("stratcon_iep_submitter", stratcon_iep_submitter); 
     706  eventer_name_callback("setup_iep_connection_callback", setup_iep_connection_callback); 
    685707  pthread_key_create(&iep_connection, connection_destroy); 
    686708 
     
    690712  iep_jobq.backq = eventer_default_backq(); 
    691713  eventer_jobq_increase_concurrency(&iep_jobq); 
     714 
     715  start_iep_daemon(); 
    692716 
    693717  /* setup our live jlog stream */