<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Stop Javascript Console execution in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/stop-javascript-console-execution/m-p/52129#M19698</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Q1: Is there a way to say STOP/EXIT in the javascript code inserted into the &lt;A href="https://github.com/share-extras/js-console" rel="nofollow noopener noreferrer"&gt;JS Console&lt;/A&gt;?&lt;/P&gt;&lt;P&gt;(i.e., is there a way to stop the JS Console running in the Alfresco repository?)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Detailed context&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I need to update &lt;EM&gt;cm:storeName&lt;/EM&gt; for &lt;STRONG&gt;1,5 million Alfresco nodes&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;I want to split the processing by date intervals (e.g., process all nodes created in January 2018).&lt;/P&gt;&lt;P&gt;I know the js code is encapsulated in a transaction and search queries return at most 1000 results.&lt;/P&gt;&lt;P&gt;I want the js code to run continuously ("Run Like Crazy" option), so I can process more than 1000 objects after I start running the js code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-javascript line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; def &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt; query&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"=cm:storeName:\"storeX\" AND @cm:created:[\"2018-01-01\" TO \"2018-01-31\"]"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; store&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"workspace://SpacesStore"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; language&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"fts-alfresco"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; nodes &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; search&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;query&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;def&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;each&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; node &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; nodes&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; node&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;properties&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"cm:storeName"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"storeY"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; node&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;save&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;nodes.length is at most 1000; when everything is done (all content is transferred to storeY), nodes.length is 0.&lt;/P&gt;&lt;P&gt;The problem is: even when all content is moved to storeY, the js code continues to run and I believe I need to restart the tomcat, which is very inconvenient. I want to say something like: "if nodes.length gets 0, please stop/exit".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Q2: If I cannot say stop/exit, is there another easy way of changing &lt;EM&gt;cm:storeName&lt;/EM&gt; for all the objects (without tomcat restart)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;Liviu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Jul 2018 12:42:58 GMT</pubDate>
    <dc:creator>liviu_ioan</dc:creator>
    <dc:date>2018-07-03T12:42:58Z</dc:date>
    <item>
      <title>Stop Javascript Console execution</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/stop-javascript-console-execution/m-p/52129#M19698</link>
      <description>Hello,Q1: Is there a way to say STOP/EXIT in the javascript code inserted into the JS Console?(i.e., is there a way to stop the JS Console running in the Alfresco repository?)Detailed contextI need to update cm:storeName for 1,5 million Alfresco nodes.I want to split the processing by date intervals</description>
      <pubDate>Tue, 03 Jul 2018 12:42:58 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/stop-javascript-console-execution/m-p/52129#M19698</guid>
      <dc:creator>liviu_ioan</dc:creator>
      <dc:date>2018-07-03T12:42:58Z</dc:date>
    </item>
    <item>
      <title>Re: Stop Javascript Console execution</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/stop-javascript-console-execution/m-p/52130#M19699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There was a misunderstanding on my side.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Clarifications&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;There is a js-console client (in Share) and a js-console server (in the Repository).&lt;BR /&gt;Run Like Crazy = &lt;EM&gt;the client&lt;/EM&gt; continuously sends the js snippet to the js-console server.&lt;/P&gt;&lt;P&gt;Misuderstanding: I thought Run Like Crazy = &lt;EM&gt;the server&lt;/EM&gt; runs continously the js snippet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As a result:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Closing the client (closing the tab in the browser) would stop the js snippet being sent to the js-console server. The same result can be achieved by setting Run Like Crazy to off.&lt;/LI&gt;&lt;LI&gt;There is no way to stop the execution of a js snippet once the js-console server has received it (except by killing tomcat on the server side, of course)&lt;/LI&gt;&lt;/OL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 08 Jul 2018 11:39:04 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/stop-javascript-console-execution/m-p/52130#M19699</guid>
      <dc:creator>liviu_ioan</dc:creator>
      <dc:date>2018-07-08T11:39:04Z</dc:date>
    </item>
    <item>
      <title>Re: Stop Javascript Console execution</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/stop-javascript-console-execution/m-p/52131#M19700</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Definitely, for doing a massive task as you commented, JS Console may be not the best option. You can not stop the process once started.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your case, I will use either CMIS script or to use a custom webscript.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my experience, the second option is very much faster. With a&amp;nbsp;CMIS script, I get more control over the process and it is easily batch-able and cron-able, while with a custom webscript execution I limit to a batch size of updates because of caches, and I use logger.warn in my js code to see in the logs how is going the custom process.&amp;nbsp;In both cases, I got a complete list of target uuids in some file, and then I split the executions for doing&amp;nbsp;5000-10000 batches.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;--C.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jul 2018 14:36:51 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/stop-javascript-console-execution/m-p/52131#M19700</guid>
      <dc:creator>cesarista</dc:creator>
      <dc:date>2018-07-09T14:36:51Z</dc:date>
    </item>
  </channel>
</rss>

