{"id":1921,"date":"2013-03-04T08:43:12","date_gmt":"2013-03-04T13:43:12","guid":{"rendered":"http:\/\/antipaucity.com\/?p=1921"},"modified":"2013-03-04T08:43:12","modified_gmt":"2013-03-04T13:43:12","slug":"dont-implement-your-scheduler-in-a-pure-queue-design","status":"publish","type":"post","link":"https:\/\/merikebi.warrenmyers.com\/?p=1921","title":{"rendered":"don&#8217;t implement your scheduler in a pure queue design"},"content":{"rendered":"<p>Recently came across a seriously funky issue with one of HP&#8217;s products (don&#8217;t laugh &#8211; I know there&#8217;s loads of funkiness in HP tools).<\/p>\n<p>HP Cloud Service Automation (3.1) allows you to schedule requests in the future. It also allows you schedule end dates for subscriptions.<\/p>\n<p>That&#8217;s neat.<\/p>\n<p>Here&#8217;s the problem: if you delete a Service Offering (which allows something to be requested in the CSA catalog) while an active subscription is\u00a0<em>using<\/em> it &#8211; any active subscriptions get delinked, and become unmanageable with the tool.<\/p>\n<p>Now the dopey scheduler comes into play.<\/p>\n<p>CSA&#8217;s scheduler works by putting all future items into a FIFO queue. What this ends up meaning is that if you have an item that fails (because, for example, you&#8217;re now past a scheduled end date, but the subscription is unlinked from an offering, so it can&#8217;t unprovision it), all other pending items fail, too. Even ones that should happen &#8220;immediately&#8221; &#8211; because &#8220;immediately&#8221; is still added to the scheduling queue&#8230; behind the erroring item(s). And since those items have errored, nothing can move forward.<\/p>\n<p>This is stupid. (And yes &#8211; RFEs have already been filed over these problems in the product.)<\/p>\n<p>Instead, have the scheduler put all items into a table &#8211; at the appointed time, iterate through the table and run everything you can &#8211; if it won&#8217;t run, flag it as an error, and move on.<\/p>\n<p>This is how <a href=\"http:\/\/en.wikipedia.org\/wiki\/Cron\">cron<\/a> works. Why would you not use a commonly-accepted, reliable way of doing things? Oh yeah &#8211; you&#8217;re HP.<\/p>\n<p>If you&#8217;re planning to write something for your product\/software\/tool &#8211; see if anyone else has done it before, and then try to mimic methods that work&#8230; please!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently came across a seriously funky issue with one of HP&#8217;s products (don&#8217;t laugh &#8211; I know there&#8217;s loads of funkiness in HP tools). HP Cloud Service Automation (3.1) allows you to schedule requests in the future. It also allows you schedule end dates for subscriptions. That&#8217;s neat. Here&#8217;s the problem: if you delete a &hellip;<br \/><a href=\"https:\/\/merikebi.warrenmyers.com\/?p=1921\" class=\"more-link pen_button pen_element_default pen_icon_arrow_double\">Continue reading <span class=\"screen-reader-text\">don&#8217;t implement your scheduler in a pure queue design<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[7,8,22,23,36,41,48],"tags":[178,208,215,222,237,303,318,391,392,422,611,658],"keyring_services":[],"class_list":["post-1921","post","type-post","status-publish","format-standard","hentry","category-commentary","category-complaint","category-ideas","category-insights","category-rant","category-technical","category-work","tag-cloud","tag-cron","tag-csa","tag-data-structures","tag-development","tag-fail","tag-fifo","tag-hp","tag-hpcsa","tag-iterative","tag-queue","tag-scheduling"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/1921","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1921"}],"version-history":[{"count":0,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/1921\/revisions"}],"wp:attachment":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1921"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1921"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1921"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fkeyring_services&post=1921"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}