Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6826339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:08:05+00:00 2026-05-26T22:08:05+00:00

Edit Ok thats typical, I figure out a possible solution to the problem just

  • 0

Edit

Ok thats typical, I figure out a possible solution to the problem just after I ask for help!

My code is now using Threading to spawn a new thread to perform the indexing independently from the current request. It seems to be working.

The code that I came up with:

private static WebDocument Document;
private static readonly object Locker = new object();

[WebMethod(true)]
public static string Index(string uri)
{
  WebDocument document = WebDocument.Get(uri);

  if (document == null)
    document = WebDocument.Create(uri);

  Document = document;
  Thread thread = new Thread(IndexThisPage);
  thread.Start();

  //document.Index();

  return "OK";
}

public static void IndexThisPage()
{
  lock (Locker)
  {
    Document.Index();
  }
}

Orginal Question

On all of my pages I have an ajax post that performs an index on the current page as well as all documents on the page. The indexer I’m using is Keyoti.

What seems to happen is when one page is being indexed any request to any other page seems to not respond (i.e. its stuck on “Waiting for server”) until the indexing is finished. Note: I’m loading the different pages from the same machine, because the code is local.

Here’s the ajax I’m using:

<script type="text/javascript" src="/Scripts/jquery-1.4.1.min.js"></script>
<script type="text/javascript">
  $(window).load(function () {
    $.ajax({
      type: "POST",
      url: "/DoIndex.aspx/Index",
      data: "{ uri: '" + self.location + "' }",
      contentType: "application/json; charset=utf-8",
      dataType: "json"
    });
  });
</script>

And the method it calls:

[WebMethod(true)]
public static string Index(string uri)
{
  WebDocument document = WebDocument.Get(uri);

  if (document == null)
    document = WebDocument.Create(uri);

  document.Index();

  return "OK";
}

Anyone have any thoughts?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:08:06+00:00Added an answer on May 26, 2026 at 10:08 pm

    your answer is completely right.
    If you using .Net 4, I’d like to let you know you could use task instead of thread.
    I guess it’s easer to read and also it’ll let the OS to decide how manage threads.

    this is the good explanation as well.

    private static WebDocument Document;
    private static readonly object Locker = new object();
    
    [WebMethod(true)]
    public static string Index(string uri)
    {
      WebDocument document = WebDocument.Get(uri);
    
      if (document == null)
        document = WebDocument.Create(uri);
    
      Document = document;
    
      // start a new background thread
      var System.Threading.Tasks.task = Task.Factory.StartNew(() => IndexThisPage);
    
      //document.Index();
    
      return "OK";
    }
    
    public static void IndexThisPage()
    {
      lock (Locker)
      {
        Document.Index();
      }
    }
    

    Thanks

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using SVG-Edit to create a pretty big SVG image file. The problem
Edit : The bug that caused this problem has been fixed. The @version tag
I am trying to figure out a good way to handle recurring events in
I'm using the Zend framework and the openid selector from http://code.google.com/p/openid-selector/ - however I
Are there any libraries out there (preferably a self contained Text Edit Control) for
Any suggestions for some sample source code for an iPhone application that shows Edit/Delete/Add
EDIT NOTE I am rewording this question entirely now that I have a bit
Consider the following typical Scala 'pimp' code: class PimpedA(a:A){ def pimp() = hi }
i can't figure out what makes an html button element appear to be pushed
I've got a DLL written in C (that I can't edit) that has some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.