KenticoDevTrev / DynamicRouting

Dynamic Routing in Kentico using a Routing Table and Assembly Attribute
15 stars 5 forks source link

URL slug queue is stucked forever when some errors occur #38

Open martinfbluesoftcz opened 3 years ago

martinfbluesoftcz commented 3 years ago

Hello, we have problem when some error occurs in URL slug queue processing queue is stucked forever. Setting Queue Error Behavior is set to Halt queue, I am afraid to change it. But I would expect scheduled task re-run all queue even when some old error is logged. But I am looking to GetNextRunnableQueueItem SQL query which is used by scheduled task to read queue items and clearly there is not change to re-run queue again and only way is to run it manually which is really bad.

Is this some intention or bug?

KenticoDevTrev commented 3 years ago

It can depend, you can force it to go, but if it's Halt and it has a legitamate error you should try to correct.

In the Dynamic Routing module UI, there should be a way to see the Queue and view the error, what does it say? What happens when you try to manually "play" the first item?

KenticoDevTrev commented 3 years ago

But yeah, i've noticed that if it gets stuck you often have to manually kick it off with the halt and wait thing.

martinfbluesoftcz commented 3 years ago

Error need not be related to Dynamic routing, for example we had issue with StackOverflowException in other part of application and this also caused Slug queue processing failed. Next week I noticed it's stucked and ran it manually.

Maybe this change in DynamicRouteInternalHelper.CheckUrlSlugGenerationQueue could help this problem, what do you think?:

public static void CheckUrlSlugGenerationQueue(bool runFromScheduledTask = false)
        {            
            // Clear any stuck tasks
            ClearStuckUrlGenerationTasks();

            if (runFromScheduledTask)
            {
                //@TODO - clear errors to ensure at least one task will be processed
            }

            //....
        }