1

I have written a TMS plugin and extracting all the components present in the pages/bundles/structure groups sent in the translation job.

While performing these operations I am sure core service must be firing enormous queries to the DB which results in time out. The exact error whihc I am getting is the given below:

A database error occurred while executing Stored Procedure "EDA_ORG_ITEMS_READ".

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. The wait operation timed out

Component: Tridion.ContentManager.CoreService Errorcode: 831

StackTrace Information Details: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() ...............

Can you please provide any pointer.

 String bundleTCM = "";            

            String bundleLocation = ConfigurationLoader.GetAppSetting("bundleLocation");
            String bundleTypeSchema = ConfigurationLoader.GetAppSetting("bundleTypeSchema");

            VirtualFolderData bundle = (VirtualFolderData)client.GetDefaultData(ItemType.VirtualFolder, bundleLocation, new ReadOptions());
            bundle.Configuration = "<Bundle xmlns=\"http://www.sdltridion.com/ContentManager/Bundle\"><Items /></Bundle>";
            bundle.TypeSchema = new LinkToSchemaData { IdRef = bundleTypeSchema };
            bundle.Title = title + " [" + string.Format("{0:yyyy-MM-dd_hh-mm}", DateTime.Now) + "]";

            TcmUri publicationId = new TcmUri(bundleLocation);
            List<String> componentIDs = new List<string>();
            XDocument doc = XDocument.Parse(bundle.Configuration);
            XNamespace xmlns = "http://www.sdltridion.com/ContentManager/Bundle";
            XNamespace xlink = "http://www.w3.org/1999/xlink";
            XElement newItemNode = null;


            foreach (PageData page in pages)
            {

                    UsedItemsFilterData filter = new UsedItemsFilterData();
                    filter.ItemTypes = new ItemType[] { ItemType.Component };
                    IdentifiableObjectData[] pageComponents = client.GetList(page.Id, filter);

                    // Get all the components included in the page and add ithem in the bundle
                    foreach (IdentifiableObjectData obj in pageComponents)
                    {
                        ComponentData component = (ComponentData)client.Read(obj.Id.ToString(), new ReadOptions { LoadFlags = LoadFlags.Expanded });


                        if (!componentIDs.Contains(component.Id))
                        {
                            componentIDs.Add(component.Id);
                            TcmUri itemUri = new TcmUri(component.Id);
                            TcmUri inContext = new TcmUri(itemUri.ItemId, itemUri.ItemType, publicationId.PublicationId);

                            if (client.IsExistingObject(inContext.ToString()))
                            {
                                newItemNode = new XElement(xmlns + "Item",
                                new XAttribute(XNamespace.Xmlns + "xlink", xlink),
                                new XAttribute(xlink + "href", inContext.ToString()));
                                doc.Root.Element(xmlns + "Items").Add(newItemNode);
                            }

                            // Add Linked Components
                         //   addLinkedComponents(doc, xmlns, xlink, newItemNode, component, componentIDs, publicationId.PublicationId, client);

                        }
                    }

                }

            bundle.Configuration = doc.ToString();
            client.Save(bundle, null);
            bundleTCM = bundle.Id;

Thanks

1
  • Not sure if anyone has faced such issue, I have tried setting up configuration as per suggestions given in other posts to increase the timeout but still no success. Providing the source code I am using which works if I am processing the list of around 60-70 pages, beyond that it gives the time out error.
    – Yash
    Commented Mar 13, 2016 at 23:47

1 Answer 1

1

I do not know what you can do about the timeout in this case, but have you considered if you can hook into the Resolved event of Translation manager?

It will give you access to all items TM considered to include in the translation job (and of course, information on if it was included or not).

The event will be raised before the state is changed, so you might need some different logic to handle errors (like the job not actually being send) - but in a pinch, you could serialize the list to disk in the Resolved event, then pick it up from the disk in your current event handler. Besides making your code simpler (hopefully) it will reduce the load on the system as this resolving does not need to happen twice (once by TM itself, and a second time from your event handler).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.