Changeset 16571 for trunk


Ignore:
Timestamp:
06/02/13 11:32:49 (11 years ago)
Author:
tbretz
Message:
Make sure that no run-file is open (this gives quite some probability that no events sevice is pending anymore, although it is asynchronous
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/scripts/CheckUnderflow.js

    r16533 r16571  
    8484    dim.send("FAD_CONTROL/SET_FILE_FORMAT", 0);
    8585
    86     // This needs a better solution! The problem is that the
    87     // event builder might still be writing a file (WritingData),
    88     // but even if the file is closed (CLOSE_OPEN_FILES) the
    89     // thread sending data (EVENT_DATA) might still be processing
    90     // events. Thus there is no real guarantee that we do not receive
    91     // data of the previous run after we have started a new one.
    92     if (dim.state("FAD_CONTROL").name=="RunInProgress")
     86    var sub_startrun = new Subscription("FAD_CONTROL/START_RUN");
     87    var sruns = sub_startrun.get(5000);
     88
     89    if (dim.state("FAD_CONTROL").name=="RunInProgress" || sruns.obj['run']!=-1)
    9390    {
    9491        dim.send("FAD_CONTROL/CLOSE_OPEN_FILES");
    9592        dim.wait("FAD_CONTROL", "Connected", 3000);
    96     }
    97     v8.sleep(1000); // Let 'timeout' in SendRawData pass
     93
     94        console.out("Waiting for open files to be closed...");
     95        v8.timeout(60000, function() { if (sub_startrun.get().obj['run']==-1) return true; });
     96
     97        // Although the file should be closed now, the processing might still be on-going
     98        // and delayed events might be received. The only fix for that issue is to
     99        // add the run number to the data we are waiting for
     100        v8.sleep(10000);
     101    }
    98102
    99103    console.out("Starting drs-gain... waiting for new event");
     
    101105    var sub_incomplete = new Subscription("FAD_CONTROL/INCOMPLETE");
    102106    var sub_connections = new Subscription("FAD_CONTROL/CONNECTIONS");
    103     var sub_startrun = new Subscription("FAD_CONTROL/START_RUN");
    104     sub_startrun.get(5000);
    105107    sub_connections.get(5000);
    106108    sub_startrun.get(5000);
     
    118120                if (dim.state("MCP").name=="TakingData" && service_event.get(0, false).counter>event_counter)
    119121                {
    120                     dim.send("FAD_CONTROL/CLOSE_OPEN_FILES");
     122                    //dim.send("FAD_CONTROL/CLOSE_OPEN_FILES");
    121123                    dim.send("MCP/STOP");
    122124                    return;
Note: See TracChangeset for help on using the changeset viewer.