Beispiel #1
0
 override protected void DoTaskReal()
 {
     if (queryable.PreAddIndexableHook(indexable))
     {
         queryable.AddIndexable(indexable);
         queryable.ConditionalFlush();
     }
 }
Beispiel #2
0
            override protected void DoTaskReal()
            {
                // Since this is a generator, we want the task to
                // get re-scheduled after it is run.
                Reschedule = true;

                // Number of times a null indexable was returned.  We don't want
                // to spin tightly in a loop here if we're not actually indexing
                // things.
                int  misfires = 0;
                bool flushed  = false;

                do
                {
                    if (!generator.HasNextIndexable())
                    {
                        // Of course, don't reschedule if there is no more work to do.
                        Reschedule = false;
                        break;
                    }

                    Indexable generated;
                    generated = generator.GetNextIndexable();

                    // Note that the indexable generator can return null.
                    // This means that the generator didn't have an indexable
                    // to return this time through, but it does not mean that
                    // its processing queue is empty.
                    if (generated == null)
                    {
                        misfires++;

                        if (misfires > 179)                         // Another totally arbitrary number
                        {
                            break;
                        }
                        else
                        {
                            continue;
                        }
                    }

                    if (queryable.PreAddIndexableHook(generated))
                    {
                        queryable.AddIndexable(generated);
                    }
                    else
                    {
                        generated.Cleanup();
                    }

                    // We keep adding indexables until a flush goes through.
                } while (!(flushed = queryable.ConditionalFlush()));

                if (!flushed)
                {
                    queryable.Flush();
                }

                generator.PostFlushHook();
            }