Cache FIND

Vote:
 

Hi,

On occastions FIND goes offline due to technical reasons. Is there away to:

1. Detect when FIND is non responsive / down

2. Cache results locally and only use when FIND is down.

Thanks

Jon

#150544
Jun 22, 2016 11:00
Vote:
 

Hi,

Out of curiosity – do you know how we can fine tune this bit of code so that it will detect a FIND Outage / Timeout etc?

 

IClient client = Client.CreateFromConfig();

           

            var feedQuery = client.Search<RCOG.Models.Pages.NewsArticleType>();

 

            feedQuery = feedQuery.Filter(x => x.StartPublish.LessThan(DateTime.Now));

            feedQuery = feedQuery.Filter(x => x.StartPublish.GreaterThan(DateTime.Now.AddMonths(-1)));

            feedQuery = feedQuery.Filter(x => !x.StopPublish.LessThan(DateTime.Now)); //AND Stop Publish date is NOT less than today  - JR-12/10/2014

            feedQuery = feedQuery.OrderByDescending(x => x.StartPublish);

            feedQuery.StaticallyCacheFor(TimeSpan.FromMinutes(30));

 

            var singleResult = feedQuery.Select(x => new NewsRssResult

            {

                Headline = string.IsNullOrEmpty(x.Headline) ? "" : x.Headline,

                Thumbnail = !string.IsNullOrEmpty(x.SearchImage) ? x.SearchImage : "",

                ImageCaption = string.IsNullOrEmpty(x.ImageCaption) ? "" : x.ImageCaption,

                Summary = x.SearchSummary,

                PublishDate = x.StartPublish,

                PageLink = string.IsNullOrEmpty(x.LinkURL) ? "" : x.LinkURL

            })

                .GetResult();



 Thanks

 

Jon

#150550
Jun 22, 2016 12:28
Vote:
 

1. I would search on something I know would return results. Like start page or similar...you can have a scheduled job that does that and sets a flag in cache that indicates that Find is down.

2. Then implement standard object caching (see my earlier blog articles for a few different ways to do that). Check flag to see if Find is down. If it is return cached. If not, get from Find and cache it...

#150555
Jun 22, 2016 13:01
Vote:
 

How about try {} catch() {}?

#150559
Jun 22, 2016 14:12
Vote:
 

We were looking at the DefaultRequestTimeout in the webconfig - this may work - but we were not sure what the Int value represents - mins or Seconds.

We changed this to 1 for it to timeout instantly and then we added a Try Catch to capture the operation Timeout exception.

Jon

#150561
Jun 22, 2016 14:53
Vote:
 

The DefaultRequestTimeout maps to TimeOut property of HttpWebRequest after a while :)

This value is in ms. So 1000 = 1 second.

https://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.timeout(v=vs.110).aspx

So setting it to 1 will probably fail all requests...

#150566
Edited, Jun 22, 2016 15:31
Vote:
 

This should solve your problems

https://world.optimizely.com/blogs/dada/dates/2022/1/find-requests-and-timeouts/

#271097
Feb 03, 2022 19:20
Vote:
 

Jonathan, I suggest putting in a vote on this feature request: https://feedback.optimizely.com/ideas/FIN-I-89

#272591
Feb 20, 2022 6:32
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.