This is a migrated thread and some comments may be shown as answers.

Infinite retrys on GetAppointments if it fails...

5 Answers 118 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Roatin Marth
Top achievements
Rank 1
Roatin Marth asked on 12 Feb 2010, 05:39 PM
How do I avoid this?
Currently if get appointments fails, it keeps retrying for some reason.

5 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 16 Feb 2010, 01:01 PM
Hi Roatin,

Can you provide more details on this case? Are there any specific steps that lead to this behavior?


Regards,
Peter
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Roatin Marth
Top achievements
Rank 1
answered on 17 Feb 2010, 05:49 PM
I'm not sure if it's anything specific. If GetAppointments fails in my business or data layer, maybe a missing proc or a parameter list discrepancy or whatever, the scheduler keep calling GetAppoiontments.
Because the scheduler has control over when GetAppointments is called, I don't think it's something I'm doing.

In firebug I just see GetAppointments being called over and over.

Here's some sample code to illustrate the flow.
I think it's fairly straight forward. I'm wondering if it has anything to do with transactions or how we're handling errors somehow...

Scheduler
       <telerik:RadScheduler  ID="RadScheduler1"  
                                                                                    runat="server"  
                                                                                    ShowAllDayRow="false" 
                                                                                    Skin="Sitefinity" 
                                                                                    SelectedView="MonthView"  
                                                                                    ShowFullTime="True"  
                                                                                    StartEditingInAdvancedForm="True" 
                                                                                    StartInsertingInAdvancedForm="True"  
                                                                                    MaximumRecurrenceCandidates="10000"  
                                                                                    OnResourcesPopulating="RadScheduler1_ResourcesPopulating"  
                                                                                    OnClientRequestFailed="ClientRequestFailed" 
                                                                                    OnClientRequestSuccess="ClientRequestSuccess" 
                                                                                    OnClientAppointmentContextMenu="AppointmentContextMenu" 
                                                                                    OnClientAppointmentContextMenuItemClicked="AppointmentContextMenuItemClicked" 
                                                                                    OnClientFormCreated="schedulerFormCreated" 
                                                                                    OnClientRecurrenceActionDialogShowing="RecurrenceActionDialogShowingHandler" 
                                                                                    OnClientAppointmentDataBound="AppointmentDataBound" 
                                                                                    OnClientAppointmentsPopulating="AppointmentsPopulating" 
                                                                                    OnClientAppointmentsPopulated="AppointmentsPopulated" 
                                                                                    OnClientAppointmentWebServiceInserting="AppointmentWebServiceInserting" 
                                                                                    OnClientAppointmentWebServiceDeleting="AppointmentWebServiceDeleting" 
                                                                                    OnClientAppointmentWebServiceUpdating="AppointmentWebServiceUpdating" 
                                                                                    OnClientAppointmentResizeStart="AppointmentResizeStart" 
                                                                                    OnClientRecurrenceExceptionCreating="AppointmentExceptionCreating" 
                                                                                    OnClientRecurrenceExceptionsRemoving="AppointmentExceptionRemoving" 
                                                                                    DataEndField="End"  
                                                                                    DataKeyField="ID"  
                                                                                    DataRecurrenceField="RecurrenceRule"  
                                                                                    DataRecurrenceParentKeyField="RecurrenceParentId" 
                                                                                    DataStartField="Start"  
                                                                                    DataSubjectField="Subject" 
                                                                                    EnableCustomAttributeEditing="True" EnableResourceEditing="False"  ValidationGroup="RadScheduler1"  
                                                                                    DisplayDeleteConfirmation="true" 
                                                                                    CustomAttributeNames="AppointmentColor, TimeZone, StartAction, EndAction, ScheduleType"
                                                     
                                                    <Localization   AdvancedEditAppointment="Edit Schedule"  
                                                                    AdvancedNewAppointment="New Schedule"  
                                                                    AdvancedSubjectRequired="Please provide a schedule subject"  
                                                                    ConfirmDeleteText="Are you sure you want to delete this schedule?"  
                                                                    ConfirmRecurrenceDeleteTitle="Deleting a recurring schedule"  
                                                                    ConfirmRecurrenceEditTitle="Editing a recurring schedule"  
                                                                    ConfirmRecurrenceMoveTitle="Moving a recurring schedule"  
                                                                    ConfirmRecurrenceResizeTitle="Resizing a recurring schedule"  
                                                                    ContextMenuAddAppointment="New Schedule"  
                                                                    ContextMenuAddRecurringAppointment="New Recurring Schedule" 
                                                                    AdvancedSubject="* Name" /> 
                                                     
                                                    <WebServiceSettings Path="SchedulerWebService.asmx"  
                                                        ResourcePopulationMode="ServerSide" /> 
                                                         
                                                        <%-- TODO Support localization --%> 
                                                        <Localization AdvancedEditAppointment="Edit Schedule" 
                                                                            AdvancedNewAppointment="New Schedule"/> 
                                                    
                                                    <AppointmentContextMenuSettings EnableDefault="True" Skin="WebBlue" /> 
                                                    <TimeSlotContextMenuSettings EnableDefault="true" /> 
                                                    <advancedform maximumheight="550px"  
                                                                            modal="True"  
                                                                            enablecustomattributeediting="True"  
                                                                            enableresourceediting="False" /> 
                                                     
                                                    <AppointmentTemplate> 
                                                        <div class="rsAptSubject"
                                                            <%# Eval("Subject") %> 
                                                        </div> 
                                                        <%# Eval("Description") %> 
                                                    </AppointmentTemplate> 
                                                     
                                                    <AdvancedEditTemplate> 
                                                        <scheduler:AdvancedForm runat="server" ID="AdvancedEditForm1" Mode="Edit" 
                                                            Subject='<%# Bind("Subject") %>' 
                                                            Description='<%# Bind("Description") %>'  
                                                            Start='<%# Bind("Start") %>' 
                                                            End='<%# Bind("End") %>' 
                                                            RecurrenceRuleText='<%# Bind("RecurrenceRule") %>'/> 
                                                    </AdvancedEditTemplate> 
                                                     
                                                    <AdvancedInsertTemplate> 
                                                        <scheduler:AdvancedForm runat="server" ID="AdvancedInsertForm1" Mode="Insert" 
                                                            Subject='<%# Bind("Subject") %>' 
                                                            Start='<%# Bind("Start") %>' 
                                                            End='<%# Bind("End") %>' 
                                                            Description='<%# Bind("Description") %>' 
                                                            RecurrenceRuleText='<%# Bind("RecurrenceRule") %>' /> 
                                                    </AdvancedInsertTemplate> 
                                                      
                                                    <TimelineView UserSelectable="false" /> 
                                                      
                                                </telerik:RadScheduler> 

Appointments populating before a call to web service get appointments
function AppointmentsPopulating(sender, eventArgs) { 
 
    spin(); 
 
    if (_userSelections.length == 0) { 
        eventArgs.set_cancel(true); 
    } 
    else { 
        var info = eventArgs.get_schedulerInfo();         
        //always use all selections from user filter when getting schedules the scheduler UI 
        info.UserSelections = _userSelections
    } 
 
function AppointmentsPopulated(sender, eventArgs) { 
    unspin(); 
 

web service
        [WebMethod] 
        public IEnumerable<AppointmentData> GetAppointments(OutputControlSchedulerInfo schedulerInfo) 
        { 
            try 
            { 
                AuthenticateUser(HttpContext.Current.User.Identity); 
 
                WebServiceAppointmentController controller = GetWebServiceAppointmentController(schedulerInfo); 
                IEnumerable<AppointmentData> appointmentDataToReturn = null
 
                using (TransactionScope transactionScope = new TransactionScope(TransactionScopeOption.Required, GetTransactionOptions(), EnterpriseServicesInteropOption.Full)) 
                { 
                    appointmentDataToReturn = controller.GetAppointments(schedulerInfo); 
                    transactionScope.Complete(); 
                } 
 
                return appointmentDataToReturn; 
            } 
            catch (Exception error) 
            { 
                LogError(new LogEntry(ApplicationKey, GetType().FullName, new StackFrame().GetMethod().Name, error)); 
                throw
            } 
        } 

provider
    public override IEnumerable<Appointment> GetAppointments(RadScheduler owner) 
        { 
            try 
            { 
                List<Appointment> appointmentsList = new List<Appointment>(); 
                List<CustomSchedule> customSchedules; 
 
                using (CustomScheduleFacade ocsf = new CustomScheduleFacade ()) 
                { 
                    customSchedules = ocsf.GetSecureCustomSchedules(HttpContext.Current.User.Identity.Name, this.scheduleInfo.UserSelections, this.scheduleInfo.ViewEnd); 
                } 
 
                foreach (CustomSchedule schedule in customSchedules) 
                { 
                    Appointment appointment = new Appointment(); 
 
                    appointment.Attributes.Add("UserSelectionId", schedule.UserSelectionId.ToString()); 
                    appointment.Attributes.Add("State", schedule.State== true ? "false" : "true"); 
                    appointment.Start = schedule.Start;
                    appointment.End = schedule.End;
                    appointment.Description = schedule.Description; 
                    appointment.Subject = schedule.Subject; 
                    appointment.RecurrenceState = schedule.RecurrenceState; 
                    appointment.RecurrenceRule = schedule.RecurrenceDescription; 
                    appointment.RecurrenceParentID = schedule.RecurrenceParentId; 
                    appointment.ID = schedule.Id; 
                    appointmentsList.Add(appointment); 
                } 
 
                return appointmentsList; 
            } 
            catch (Exception error) 
            { 
                LogError(new LogEntry(ApplicationKey, this.GetType().FullName, new StackFrame().GetMethod().Name, error)); 
                throw
            } 
        } 

0
T. Tsonev
Telerik team
answered on 23 Feb 2010, 11:27 AM
Hello Roatin,

Thank you for sending the sample code. Currently RadScheduler will not automatically retry the request on itself. In order to issue a new request you have to change either the selected date or selected view.

What does your ClientRequestFailed handler do? Do you have any form of retry logic there?

Sincerely yours,
Tsvetomir Tsonev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Roatin Marth
Top achievements
Rank 1
answered on 29 Apr 2010, 02:41 PM
Yes, you're correct.
It was an error on my part in the fail handler where the grid was being refreshed which of course causes it to call get...

Cheerio!
0
towpse
Top achievements
Rank 2
answered on 11 Jan 2012, 03:52 PM
I'm having a similar issue.
I need to refresh the grid when a request fails because if a delete or update fails, I need to rebind the schedule so after the failed request the schedule returns to the state it was displaying before the error.
setting cancel eventArgs.set_cancel(true); in clientRequestFailed doesn't seem to stop the schedule from removing a deleted occurrence if the web service request fails so i was forced to refresh the grid by refreshing the current date in the scheduler: scheduler.set_selectedDate(scheduler.get_selectedDate());

the problem is if GetAppointments fails, clientRequestFailed gets called and I refresh the grid in the handler only to call GetAppointments again to fail and I'm caught in a loop.

I need a way to flag that GetAppointments has been called somehow so that I know not to manually refresh the grid.

word
Tags
Scheduler
Asked by
Roatin Marth
Top achievements
Rank 1
Answers by
Peter
Telerik team
Roatin Marth
Top achievements
Rank 1
T. Tsonev
Telerik team
towpse
Top achievements
Rank 2
Share this question
or