ssssssss-team / spider-flow

新一代爬虫平台,以图形化方式定义爬虫流程,不写代码即可完成爬虫。
https://www.spiderflow.org
MIT License
9.61k stars 1.86k forks source link

启动两个爬虫的时候会死循环 #32

Closed MrJo621 closed 2 years ago

MrJo621 commented 2 years ago

image

filter的时候没数据

nekolr commented 2 years ago

麻烦提供运行上下文,比如爬虫的配置,操作过程

MrJo621 commented 2 years ago
<mxGraphModel>
  <root>
    <mxCell id="0">
      <JsonProperty as="data">
        {&quot;spiderName&quot;:&quot;文献爬虫healio&quot;,&quot;submit-strategy&quot;:&quot;random&quot;,&quot;threadCount&quot;:&quot;&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="1" parent="0"/>
    <mxCell id="2" value="开始" style="start" parent="1" vertex="1">
      <mxGeometry x="10" y="80" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;shape&quot;:&quot;start&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="11" value="开始抓取" style="request" parent="1" vertex="1">
      <mxGeometry x="200" y="80" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;开始抓取&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;method&quot;:&quot;GET&quot;,&quot;sleep&quot;:&quot;5000&quot;,&quot;timeout&quot;:&quot;5000&quot;,&quot;response-charset&quot;:&quot;&quot;,&quot;retryCount&quot;:&quot;&quot;,&quot;retryInterval&quot;:&quot;&quot;,&quot;body-type&quot;:&quot;none&quot;,&quot;body-content-type&quot;:&quot;text/plain&quot;,&quot;loopCount&quot;:&quot;&quot;,&quot;url&quot;:&quot;https://www.healio.com/h5news/specialtylanding/searchjson?page=${item+1}&amp;pageId={A2F15EEF-2C14-40FC-A9C5-F54E929EEFD8}&quot;,&quot;proxy&quot;:&quot;&quot;,&quot;request-body&quot;:&quot;&quot;,&quot;follow-redirect&quot;:&quot;1&quot;,&quot;tls-validate&quot;:&quot;1&quot;,&quot;cookie-auto-set&quot;:&quot;1&quot;,&quot;repeat-enable&quot;:&quot;0&quot;,&quot;shape&quot;:&quot;request&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="15" value="定义变量" style="variable" parent="1" vertex="1">
      <mxGeometry x="360" y="80" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;定义变量&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;variable-name&quot;:[&quot;cards&quot;,&quot;titleList&quot;],&quot;variable-description&quot;:[&quot;&quot;,&quot;&quot;],&quot;loopCount&quot;:&quot;&quot;,&quot;variable-value&quot;:[&quot;${json.parse(resp.html).cards}&quot;,&quot;${json.parse(resp.html).cards}&quot;],&quot;shape&quot;:&quot;variable&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="16" value="" style="strokeWidth=2;sharp=1;" parent="1" source="11" target="15" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="17" value="循环" style="loop" parent="1" vertex="1">
      <mxGeometry x="510" y="80" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;循环&quot;,&quot;loopItem&quot;:&quot;&quot;,&quot;loopVariableName&quot;:&quot;index&quot;,&quot;loopCount&quot;:&quot;${list.length(cards)}&quot;,&quot;loopStart&quot;:&quot;0&quot;,&quot;loopEnd&quot;:&quot;-1&quot;,&quot;shape&quot;:&quot;loop&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="18" value="" style="strokeWidth=2;sharp=1;" parent="1" source="15" target="17" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="22" value="定义每篇文章的信息" style="variable" parent="1" vertex="1">
      <mxGeometry x="510" y="160" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;定义每篇文章的信息&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;variable-name&quot;:[&quot;articleDate&quot;,&quot;articalAbstract&quot;,&quot;articalUrl&quot;,&quot;articalTitle&quot;],&quot;variable-description&quot;:[&quot;发布日期&quot;,&quot;简介&quot;,&quot;&quot;,&quot;&quot;],&quot;loopCount&quot;:&quot;&quot;,&quot;variable-value&quot;:[&quot;${cards[index].PostedDate}&quot;,&quot;${cards[index].FirstParagraph}&quot;,&quot;https://www.healio.com${cards[index].Link}&quot;,&quot;${cards[index].Title}&quot;],&quot;shape&quot;:&quot;variable&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="24" value="" style="strokeWidth=2;strokeColor=blue;sharp=1;" parent="1" source="17" target="22" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;blue&quot;,&quot;condition&quot;:&quot;${cards[index].Link != null}&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="27" value="循环" style="loop" parent="1" vertex="1">
      <mxGeometry x="90" y="130" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;循环&quot;,&quot;loopItem&quot;:&quot;&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;loopCount&quot;:&quot;4&quot;,&quot;loopStart&quot;:&quot;0&quot;,&quot;loopEnd&quot;:&quot;-1&quot;,&quot;shape&quot;:&quot;loop&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="28" value="" style="strokeWidth=2;sharp=1;" parent="1" source="2" target="27" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="29" value="" style="strokeWidth=2;sharp=1;" parent="1" source="27" target="11" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="30" value="输出" style="output" parent="1" vertex="1">
      <mxGeometry x="630" y="160" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;输出&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;datasourceId&quot;:&quot;4c05381d67a342390df8b0847a1275c4&quot;,&quot;tableName&quot;:&quot;artical_literature&quot;,&quot;csvName&quot;:&quot;C:/Users/18752/Desktop/新建文本文档 (2)&quot;,&quot;csvEncoding&quot;:&quot;UTF-8&quot;,&quot;output-name&quot;:[&quot;article_date&quot;,&quot;artical_abstract&quot;,&quot;artical_url&quot;,&quot;artical_title&quot;,&quot;batch&quot;,&quot;artical_type&quot;],&quot;loopCount&quot;:&quot;&quot;,&quot;output-value&quot;:[&quot;${articleDate}&quot;,&quot;${articalAbstract}&quot;,&quot;${articalUrl}&quot;,&quot;${articalTitle}&quot;,&quot;${date.format(date.now(),&#39;yyyy-MM-dd&#39;)}&quot;,&quot;healio&quot;],&quot;output-all&quot;:&quot;1&quot;,&quot;output-database&quot;:&quot;0&quot;,&quot;output-csv&quot;:&quot;0&quot;,&quot;shape&quot;:&quot;output&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="31" value="" style="strokeWidth=2;sharp=1;" parent="1" source="22" target="30" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
  </root>
</mxGraphModel>

这是第一个-------------------------------------------------------------

<mxGraphModel>
  <root>
    <mxCell id="0">
      <JsonProperty as="data">
        {&quot;spiderName&quot;:&quot;文献爬虫frontiers_in_immunology&quot;,&quot;submit-strategy&quot;:&quot;random&quot;,&quot;threadCount&quot;:&quot;&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="1" parent="0"/>
    <mxCell id="2" value="开始" style="start" parent="1" vertex="1">
      <mxGeometry x="10" y="80" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;shape&quot;:&quot;start&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="15" value="定义变量" style="variable" parent="1" vertex="1">
      <mxGeometry x="360" y="80" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;定义变量&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;variable-name&quot;:[&quot;articles&quot;],&quot;variable-description&quot;:[&quot;&quot;],&quot;loopCount&quot;:&quot;&quot;,&quot;variable-value&quot;:[&quot;${json.parse(resp.html).ArticleCollection.Articles}&quot;],&quot;shape&quot;:&quot;variable&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="17" value="循环" style="loop" parent="1" vertex="1">
      <mxGeometry x="510" y="80" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;循环&quot;,&quot;loopItem&quot;:&quot;&quot;,&quot;loopVariableName&quot;:&quot;index&quot;,&quot;loopCount&quot;:&quot;${list.length(articles)}&quot;,&quot;loopStart&quot;:&quot;0&quot;,&quot;loopEnd&quot;:&quot;-1&quot;,&quot;shape&quot;:&quot;loop&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="18" value="" style="strokeWidth=2;sharp=1;" parent="1" source="15" target="17" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="22" value="定义每篇文章的信息" style="variable" parent="1" vertex="1">
      <mxGeometry x="510" y="160" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;定义每篇文章的信息&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;variable-name&quot;:[&quot;articleDate&quot;,&quot;articalAbstract&quot;,&quot;articalUrl&quot;,&quot;articalTitle&quot;,&quot;articalauthor&quot;,&quot;doi&quot;],&quot;variable-description&quot;:[&quot;发布日期&quot;,&quot;简介&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;],&quot;loopCount&quot;:&quot;&quot;,&quot;variable-value&quot;:[&quot;${articles[index].OnlineSinceDate}&quot;,&quot;${articles[index].OnlineSinceDate}&quot;,&quot;${articles[index].Url}&quot;,&quot;${articles[index].Title}&quot;,&quot;${json.stringify(articles[index].Authors)}&quot;,&quot;${articles[index].DOI}&quot;],&quot;shape&quot;:&quot;variable&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="24" value="" style="strokeWidth=2;strokeColor=black;sharp=1;" parent="1" source="17" target="22" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="25" value="输出" style="output" parent="1" vertex="1">
      <mxGeometry x="510" y="240" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;输出&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;datasourceId&quot;:&quot;4c05381d67a342390df8b0847a1275c4&quot;,&quot;tableName&quot;:&quot;artical_literature&quot;,&quot;csvName&quot;:&quot;C:/Users/18752/Desktop/新建文本文档 (2)&quot;,&quot;csvEncoding&quot;:&quot;UTF-8&quot;,&quot;output-name&quot;:[&quot;article_date&quot;,&quot;artical_abstract&quot;,&quot;artical_url&quot;,&quot;artical_title&quot;,&quot;batch&quot;,&quot;artical_type&quot;,&quot;artical_author&quot;,&quot;doi&quot;],&quot;loopCount&quot;:&quot;&quot;,&quot;output-value&quot;:[&quot;${articleDate}&quot;,&quot;${articalAbstract}&quot;,&quot;${articalUrl}&quot;,&quot;${articalTitle}&quot;,&quot;${date.format(date.now(),&#39;yyyy-MM-dd&#39;)}&quot;,&quot;frontiers_in_immunology&quot;,&quot;${articalauthor}&quot;,&quot;${doi}&quot;],&quot;output-all&quot;:&quot;1&quot;,&quot;output-database&quot;:&quot;0&quot;,&quot;output-csv&quot;:&quot;0&quot;,&quot;shape&quot;:&quot;output&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="26" value="" style="strokeWidth=2;sharp=1;" parent="1" source="22" target="25" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="27" value="循环" style="loop" parent="1" vertex="1">
      <mxGeometry x="90" y="130" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;循环&quot;,&quot;loopItem&quot;:&quot;&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;loopCount&quot;:&quot;5&quot;,&quot;loopStart&quot;:&quot;0&quot;,&quot;loopEnd&quot;:&quot;-1&quot;,&quot;shape&quot;:&quot;loop&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="28" value="" style="strokeWidth=2;sharp=1;" parent="1" source="2" target="27" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="32" value="开始抓取" style="request" parent="1" vertex="1">
      <mxGeometry x="230" y="80" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;开始抓取&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;method&quot;:&quot;POST&quot;,&quot;sleep&quot;:&quot;&quot;,&quot;timeout&quot;:&quot;&quot;,&quot;response-charset&quot;:&quot;&quot;,&quot;retryCount&quot;:&quot;&quot;,&quot;retryInterval&quot;:&quot;&quot;,&quot;body-type&quot;:&quot;form-data&quot;,&quot;body-content-type&quot;:&quot;text/plain&quot;,&quot;parameter-form-name&quot;:[&quot;JournalId&quot;,&quot;SectionId&quot;,&quot;FromDate&quot;,&quot;ToDate&quot;,&quot;SortType&quot;],&quot;parameter-form-type&quot;:[&quot;text&quot;,&quot;text&quot;,&quot;text&quot;,&quot;text&quot;,&quot;text&quot;],&quot;parameter-form-description&quot;:[&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;],&quot;loopCount&quot;:&quot;&quot;,&quot;url&quot;:&quot;https://www.frontiersin.org/api/journals/article/filter?index=${item}&quot;,&quot;proxy&quot;:&quot;&quot;,&quot;request-body&quot;:&quot;&quot;,&quot;parameter-form-filename&quot;:[&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;],&quot;parameter-form-value&quot;:[&quot;276&quot;,&quot;0&quot;,&quot;&quot;,&quot;&quot;,&quot;recentdate&quot;],&quot;follow-redirect&quot;:&quot;1&quot;,&quot;tls-validate&quot;:&quot;1&quot;,&quot;cookie-auto-set&quot;:&quot;1&quot;,&quot;repeat-enable&quot;:&quot;0&quot;,&quot;shape&quot;:&quot;request&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="33" value="" style="strokeWidth=2;sharp=1;" parent="1" source="27" target="32" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="34" value="" style="strokeWidth=2;sharp=1;" parent="1" source="32" target="15" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
  </root>
</mxGraphModel>

---------------------这是第二个 先启动第一个,再启动第二个,然后就会一直在while的地方卡住,debug看下来是queue中的Future的isDone都为false,导致选不出max

max的值为Optional.empty

平台最大线程数

spider.thread.max=4

单任务默认最大线程数

spider.thread.default=2

设置为true时定时任务才生效

spider.job.enable=true 这个是线程的配置 环境是windows10 idea2021.1.3x64 jdk8

nekolr commented 2 years ago

请先尝试调大线程数,这个问题稍后我会尝试复现并排查

nekolr commented 2 years ago
<mxGraphModel>
  <root>
    <mxCell id="0">
      <JsonProperty as="data">
        {&quot;spiderName&quot;:&quot;文献爬虫healio&quot;,&quot;submit-strategy&quot;:&quot;random&quot;,&quot;threadCount&quot;:&quot;&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="1" parent="0"/>
    <mxCell id="2" value="开始" style="start" parent="1" vertex="1">
      <mxGeometry x="10" y="80" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;shape&quot;:&quot;start&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="11" value="开始抓取" style="request" parent="1" vertex="1">
      <mxGeometry x="200" y="80" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;开始抓取&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;method&quot;:&quot;GET&quot;,&quot;sleep&quot;:&quot;5000&quot;,&quot;timeout&quot;:&quot;5000&quot;,&quot;response-charset&quot;:&quot;&quot;,&quot;retryCount&quot;:&quot;&quot;,&quot;retryInterval&quot;:&quot;&quot;,&quot;body-type&quot;:&quot;none&quot;,&quot;body-content-type&quot;:&quot;text/plain&quot;,&quot;loopCount&quot;:&quot;&quot;,&quot;url&quot;:&quot;https://www.healio.com/h5news/specialtylanding/searchjson?page=${item+1}&amp;pageId={A2F15EEF-2C14-40FC-A9C5-F54E929EEFD8}&quot;,&quot;proxy&quot;:&quot;&quot;,&quot;request-body&quot;:&quot;&quot;,&quot;follow-redirect&quot;:&quot;1&quot;,&quot;tls-validate&quot;:&quot;1&quot;,&quot;cookie-auto-set&quot;:&quot;1&quot;,&quot;repeat-enable&quot;:&quot;0&quot;,&quot;shape&quot;:&quot;request&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="15" value="定义变量" style="variable" parent="1" vertex="1">
      <mxGeometry x="360" y="80" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;定义变量&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;variable-name&quot;:[&quot;cards&quot;,&quot;titleList&quot;],&quot;variable-description&quot;:[&quot;&quot;,&quot;&quot;],&quot;loopCount&quot;:&quot;&quot;,&quot;variable-value&quot;:[&quot;${json.parse(resp.html).cards}&quot;,&quot;${json.parse(resp.html).cards}&quot;],&quot;shape&quot;:&quot;variable&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="16" value="" style="strokeWidth=2;sharp=1;" parent="1" source="11" target="15" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="17" value="循环" style="loop" parent="1" vertex="1">
      <mxGeometry x="510" y="80" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;循环&quot;,&quot;loopItem&quot;:&quot;&quot;,&quot;loopVariableName&quot;:&quot;index&quot;,&quot;loopCount&quot;:&quot;${list.length(cards)}&quot;,&quot;loopStart&quot;:&quot;0&quot;,&quot;loopEnd&quot;:&quot;-1&quot;,&quot;shape&quot;:&quot;loop&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="18" value="" style="strokeWidth=2;sharp=1;" parent="1" source="15" target="17" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="22" value="定义每篇文章的信息" style="variable" parent="1" vertex="1">
      <mxGeometry x="510" y="160" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;定义每篇文章的信息&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;variable-name&quot;:[&quot;articleDate&quot;,&quot;articalAbstract&quot;,&quot;articalUrl&quot;,&quot;articalTitle&quot;],&quot;variable-description&quot;:[&quot;发布日期&quot;,&quot;简介&quot;,&quot;&quot;,&quot;&quot;],&quot;loopCount&quot;:&quot;&quot;,&quot;variable-value&quot;:[&quot;${cards[index].PostedDate}&quot;,&quot;${cards[index].FirstParagraph}&quot;,&quot;https://www.healio.com${cards[index].Link}&quot;,&quot;${cards[index].Title}&quot;],&quot;shape&quot;:&quot;variable&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="24" value="" style="strokeWidth=2;strokeColor=blue;sharp=1;" parent="1" source="17" target="22" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;blue&quot;,&quot;condition&quot;:&quot;${cards[index].Link != null}&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="27" value="循环" style="loop" parent="1" vertex="1">
      <mxGeometry x="90" y="130" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;循环&quot;,&quot;loopItem&quot;:&quot;&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;loopCount&quot;:&quot;4&quot;,&quot;loopStart&quot;:&quot;0&quot;,&quot;loopEnd&quot;:&quot;-1&quot;,&quot;shape&quot;:&quot;loop&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="28" value="" style="strokeWidth=2;sharp=1;" parent="1" source="2" target="27" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="29" value="" style="strokeWidth=2;sharp=1;" parent="1" source="27" target="11" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="30" value="输出" style="output" parent="1" vertex="1">
      <mxGeometry x="630" y="160" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;输出&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;datasourceId&quot;:&quot;4c05381d67a342390df8b0847a1275c4&quot;,&quot;tableName&quot;:&quot;artical_literature&quot;,&quot;csvName&quot;:&quot;C:/Users/18752/Desktop/新建文本文档 (2)&quot;,&quot;csvEncoding&quot;:&quot;UTF-8&quot;,&quot;output-name&quot;:[&quot;article_date&quot;,&quot;artical_abstract&quot;,&quot;artical_url&quot;,&quot;artical_title&quot;,&quot;batch&quot;,&quot;artical_type&quot;],&quot;loopCount&quot;:&quot;&quot;,&quot;output-value&quot;:[&quot;${articleDate}&quot;,&quot;${articalAbstract}&quot;,&quot;${articalUrl}&quot;,&quot;${articalTitle}&quot;,&quot;${date.format(date.now(),&#39;yyyy-MM-dd&#39;)}&quot;,&quot;healio&quot;],&quot;output-all&quot;:&quot;1&quot;,&quot;output-database&quot;:&quot;0&quot;,&quot;output-csv&quot;:&quot;0&quot;,&quot;shape&quot;:&quot;output&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="31" value="" style="strokeWidth=2;sharp=1;" parent="1" source="22" target="30" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
  </root>
</mxGraphModel>

这是第一个-------------------------------------------------------------

<mxGraphModel>
  <root>
    <mxCell id="0">
      <JsonProperty as="data">
        {&quot;spiderName&quot;:&quot;文献爬虫frontiers_in_immunology&quot;,&quot;submit-strategy&quot;:&quot;random&quot;,&quot;threadCount&quot;:&quot;&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="1" parent="0"/>
    <mxCell id="2" value="开始" style="start" parent="1" vertex="1">
      <mxGeometry x="10" y="80" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;shape&quot;:&quot;start&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="15" value="定义变量" style="variable" parent="1" vertex="1">
      <mxGeometry x="360" y="80" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;定义变量&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;variable-name&quot;:[&quot;articles&quot;],&quot;variable-description&quot;:[&quot;&quot;],&quot;loopCount&quot;:&quot;&quot;,&quot;variable-value&quot;:[&quot;${json.parse(resp.html).ArticleCollection.Articles}&quot;],&quot;shape&quot;:&quot;variable&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="17" value="循环" style="loop" parent="1" vertex="1">
      <mxGeometry x="510" y="80" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;循环&quot;,&quot;loopItem&quot;:&quot;&quot;,&quot;loopVariableName&quot;:&quot;index&quot;,&quot;loopCount&quot;:&quot;${list.length(articles)}&quot;,&quot;loopStart&quot;:&quot;0&quot;,&quot;loopEnd&quot;:&quot;-1&quot;,&quot;shape&quot;:&quot;loop&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="18" value="" style="strokeWidth=2;sharp=1;" parent="1" source="15" target="17" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="22" value="定义每篇文章的信息" style="variable" parent="1" vertex="1">
      <mxGeometry x="510" y="160" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;定义每篇文章的信息&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;variable-name&quot;:[&quot;articleDate&quot;,&quot;articalAbstract&quot;,&quot;articalUrl&quot;,&quot;articalTitle&quot;,&quot;articalauthor&quot;,&quot;doi&quot;],&quot;variable-description&quot;:[&quot;发布日期&quot;,&quot;简介&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;],&quot;loopCount&quot;:&quot;&quot;,&quot;variable-value&quot;:[&quot;${articles[index].OnlineSinceDate}&quot;,&quot;${articles[index].OnlineSinceDate}&quot;,&quot;${articles[index].Url}&quot;,&quot;${articles[index].Title}&quot;,&quot;${json.stringify(articles[index].Authors)}&quot;,&quot;${articles[index].DOI}&quot;],&quot;shape&quot;:&quot;variable&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="24" value="" style="strokeWidth=2;strokeColor=black;sharp=1;" parent="1" source="17" target="22" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="25" value="输出" style="output" parent="1" vertex="1">
      <mxGeometry x="510" y="240" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;输出&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;datasourceId&quot;:&quot;4c05381d67a342390df8b0847a1275c4&quot;,&quot;tableName&quot;:&quot;artical_literature&quot;,&quot;csvName&quot;:&quot;C:/Users/18752/Desktop/新建文本文档 (2)&quot;,&quot;csvEncoding&quot;:&quot;UTF-8&quot;,&quot;output-name&quot;:[&quot;article_date&quot;,&quot;artical_abstract&quot;,&quot;artical_url&quot;,&quot;artical_title&quot;,&quot;batch&quot;,&quot;artical_type&quot;,&quot;artical_author&quot;,&quot;doi&quot;],&quot;loopCount&quot;:&quot;&quot;,&quot;output-value&quot;:[&quot;${articleDate}&quot;,&quot;${articalAbstract}&quot;,&quot;${articalUrl}&quot;,&quot;${articalTitle}&quot;,&quot;${date.format(date.now(),&#39;yyyy-MM-dd&#39;)}&quot;,&quot;frontiers_in_immunology&quot;,&quot;${articalauthor}&quot;,&quot;${doi}&quot;],&quot;output-all&quot;:&quot;1&quot;,&quot;output-database&quot;:&quot;0&quot;,&quot;output-csv&quot;:&quot;0&quot;,&quot;shape&quot;:&quot;output&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="26" value="" style="strokeWidth=2;sharp=1;" parent="1" source="22" target="25" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="27" value="循环" style="loop" parent="1" vertex="1">
      <mxGeometry x="90" y="130" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;循环&quot;,&quot;loopItem&quot;:&quot;&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;loopCount&quot;:&quot;5&quot;,&quot;loopStart&quot;:&quot;0&quot;,&quot;loopEnd&quot;:&quot;-1&quot;,&quot;shape&quot;:&quot;loop&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="28" value="" style="strokeWidth=2;sharp=1;" parent="1" source="2" target="27" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="32" value="开始抓取" style="request" parent="1" vertex="1">
      <mxGeometry x="230" y="80" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;开始抓取&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;method&quot;:&quot;POST&quot;,&quot;sleep&quot;:&quot;&quot;,&quot;timeout&quot;:&quot;&quot;,&quot;response-charset&quot;:&quot;&quot;,&quot;retryCount&quot;:&quot;&quot;,&quot;retryInterval&quot;:&quot;&quot;,&quot;body-type&quot;:&quot;form-data&quot;,&quot;body-content-type&quot;:&quot;text/plain&quot;,&quot;parameter-form-name&quot;:[&quot;JournalId&quot;,&quot;SectionId&quot;,&quot;FromDate&quot;,&quot;ToDate&quot;,&quot;SortType&quot;],&quot;parameter-form-type&quot;:[&quot;text&quot;,&quot;text&quot;,&quot;text&quot;,&quot;text&quot;,&quot;text&quot;],&quot;parameter-form-description&quot;:[&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;],&quot;loopCount&quot;:&quot;&quot;,&quot;url&quot;:&quot;https://www.frontiersin.org/api/journals/article/filter?index=${item}&quot;,&quot;proxy&quot;:&quot;&quot;,&quot;request-body&quot;:&quot;&quot;,&quot;parameter-form-filename&quot;:[&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;],&quot;parameter-form-value&quot;:[&quot;276&quot;,&quot;0&quot;,&quot;&quot;,&quot;&quot;,&quot;recentdate&quot;],&quot;follow-redirect&quot;:&quot;1&quot;,&quot;tls-validate&quot;:&quot;1&quot;,&quot;cookie-auto-set&quot;:&quot;1&quot;,&quot;repeat-enable&quot;:&quot;0&quot;,&quot;shape&quot;:&quot;request&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="33" value="" style="strokeWidth=2;sharp=1;" parent="1" source="27" target="32" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="34" value="" style="strokeWidth=2;sharp=1;" parent="1" source="32" target="15" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
  </root>
</mxGraphModel>

---------------------这是第二个 先启动第一个,再启动第二个,然后就会一直在while的地方卡住,debug看下来是queue中的Future的isDone都为false,导致选不出max

max的值为Optional.empty

平台最大线程数 spider.thread.max=4 #单任务默认最大线程数 spider.thread.default=2 #设置为true时定时任务才生效 spider.job.enable=true 这个是线程的配置 环境是windows10 idea2021.1.3x64 jdk8

首先说明的是:这不是 bug。简单说一下机制:每个流程都会启动两个线程工作,一个线程阻塞等待结果,一个线程用来调度,因此如果你同时启动两个流程,至少要保证最大线程数的限制大于 4。你可以试着将最大限制调整成 5 再尝试一下。

MrJo621 commented 2 years ago
<mxGraphModel>
  <root>
    <mxCell id="0">
      <JsonProperty as="data">
        {&quot;spiderName&quot;:&quot;文献爬虫healio&quot;,&quot;submit-strategy&quot;:&quot;random&quot;,&quot;threadCount&quot;:&quot;&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="1" parent="0"/>
    <mxCell id="2" value="开始" style="start" parent="1" vertex="1">
      <mxGeometry x="10" y="80" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;shape&quot;:&quot;start&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="11" value="开始抓取" style="request" parent="1" vertex="1">
      <mxGeometry x="200" y="80" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;开始抓取&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;method&quot;:&quot;GET&quot;,&quot;sleep&quot;:&quot;5000&quot;,&quot;timeout&quot;:&quot;5000&quot;,&quot;response-charset&quot;:&quot;&quot;,&quot;retryCount&quot;:&quot;&quot;,&quot;retryInterval&quot;:&quot;&quot;,&quot;body-type&quot;:&quot;none&quot;,&quot;body-content-type&quot;:&quot;text/plain&quot;,&quot;loopCount&quot;:&quot;&quot;,&quot;url&quot;:&quot;https://www.healio.com/h5news/specialtylanding/searchjson?page=${item+1}&amp;pageId={A2F15EEF-2C14-40FC-A9C5-F54E929EEFD8}&quot;,&quot;proxy&quot;:&quot;&quot;,&quot;request-body&quot;:&quot;&quot;,&quot;follow-redirect&quot;:&quot;1&quot;,&quot;tls-validate&quot;:&quot;1&quot;,&quot;cookie-auto-set&quot;:&quot;1&quot;,&quot;repeat-enable&quot;:&quot;0&quot;,&quot;shape&quot;:&quot;request&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="15" value="定义变量" style="variable" parent="1" vertex="1">
      <mxGeometry x="360" y="80" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;定义变量&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;variable-name&quot;:[&quot;cards&quot;,&quot;titleList&quot;],&quot;variable-description&quot;:[&quot;&quot;,&quot;&quot;],&quot;loopCount&quot;:&quot;&quot;,&quot;variable-value&quot;:[&quot;${json.parse(resp.html).cards}&quot;,&quot;${json.parse(resp.html).cards}&quot;],&quot;shape&quot;:&quot;variable&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="16" value="" style="strokeWidth=2;sharp=1;" parent="1" source="11" target="15" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="17" value="循环" style="loop" parent="1" vertex="1">
      <mxGeometry x="510" y="80" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;循环&quot;,&quot;loopItem&quot;:&quot;&quot;,&quot;loopVariableName&quot;:&quot;index&quot;,&quot;loopCount&quot;:&quot;${list.length(cards)}&quot;,&quot;loopStart&quot;:&quot;0&quot;,&quot;loopEnd&quot;:&quot;-1&quot;,&quot;shape&quot;:&quot;loop&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="18" value="" style="strokeWidth=2;sharp=1;" parent="1" source="15" target="17" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="22" value="定义每篇文章的信息" style="variable" parent="1" vertex="1">
      <mxGeometry x="510" y="160" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;定义每篇文章的信息&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;variable-name&quot;:[&quot;articleDate&quot;,&quot;articalAbstract&quot;,&quot;articalUrl&quot;,&quot;articalTitle&quot;],&quot;variable-description&quot;:[&quot;发布日期&quot;,&quot;简介&quot;,&quot;&quot;,&quot;&quot;],&quot;loopCount&quot;:&quot;&quot;,&quot;variable-value&quot;:[&quot;${cards[index].PostedDate}&quot;,&quot;${cards[index].FirstParagraph}&quot;,&quot;https://www.healio.com${cards[index].Link}&quot;,&quot;${cards[index].Title}&quot;],&quot;shape&quot;:&quot;variable&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="24" value="" style="strokeWidth=2;strokeColor=blue;sharp=1;" parent="1" source="17" target="22" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;blue&quot;,&quot;condition&quot;:&quot;${cards[index].Link != null}&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="27" value="循环" style="loop" parent="1" vertex="1">
      <mxGeometry x="90" y="130" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;循环&quot;,&quot;loopItem&quot;:&quot;&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;loopCount&quot;:&quot;4&quot;,&quot;loopStart&quot;:&quot;0&quot;,&quot;loopEnd&quot;:&quot;-1&quot;,&quot;shape&quot;:&quot;loop&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="28" value="" style="strokeWidth=2;sharp=1;" parent="1" source="2" target="27" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="29" value="" style="strokeWidth=2;sharp=1;" parent="1" source="27" target="11" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="30" value="输出" style="output" parent="1" vertex="1">
      <mxGeometry x="630" y="160" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;输出&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;datasourceId&quot;:&quot;4c05381d67a342390df8b0847a1275c4&quot;,&quot;tableName&quot;:&quot;artical_literature&quot;,&quot;csvName&quot;:&quot;C:/Users/18752/Desktop/新建文本文档 (2)&quot;,&quot;csvEncoding&quot;:&quot;UTF-8&quot;,&quot;output-name&quot;:[&quot;article_date&quot;,&quot;artical_abstract&quot;,&quot;artical_url&quot;,&quot;artical_title&quot;,&quot;batch&quot;,&quot;artical_type&quot;],&quot;loopCount&quot;:&quot;&quot;,&quot;output-value&quot;:[&quot;${articleDate}&quot;,&quot;${articalAbstract}&quot;,&quot;${articalUrl}&quot;,&quot;${articalTitle}&quot;,&quot;${date.format(date.now(),&#39;yyyy-MM-dd&#39;)}&quot;,&quot;healio&quot;],&quot;output-all&quot;:&quot;1&quot;,&quot;output-database&quot;:&quot;0&quot;,&quot;output-csv&quot;:&quot;0&quot;,&quot;shape&quot;:&quot;output&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="31" value="" style="strokeWidth=2;sharp=1;" parent="1" source="22" target="30" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
  </root>
</mxGraphModel>

这是第一个-------------------------------------------------------------

<mxGraphModel>
  <root>
    <mxCell id="0">
      <JsonProperty as="data">
        {&quot;spiderName&quot;:&quot;文献爬虫frontiers_in_immunology&quot;,&quot;submit-strategy&quot;:&quot;random&quot;,&quot;threadCount&quot;:&quot;&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="1" parent="0"/>
    <mxCell id="2" value="开始" style="start" parent="1" vertex="1">
      <mxGeometry x="10" y="80" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;shape&quot;:&quot;start&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="15" value="定义变量" style="variable" parent="1" vertex="1">
      <mxGeometry x="360" y="80" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;定义变量&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;variable-name&quot;:[&quot;articles&quot;],&quot;variable-description&quot;:[&quot;&quot;],&quot;loopCount&quot;:&quot;&quot;,&quot;variable-value&quot;:[&quot;${json.parse(resp.html).ArticleCollection.Articles}&quot;],&quot;shape&quot;:&quot;variable&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="17" value="循环" style="loop" parent="1" vertex="1">
      <mxGeometry x="510" y="80" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;循环&quot;,&quot;loopItem&quot;:&quot;&quot;,&quot;loopVariableName&quot;:&quot;index&quot;,&quot;loopCount&quot;:&quot;${list.length(articles)}&quot;,&quot;loopStart&quot;:&quot;0&quot;,&quot;loopEnd&quot;:&quot;-1&quot;,&quot;shape&quot;:&quot;loop&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="18" value="" style="strokeWidth=2;sharp=1;" parent="1" source="15" target="17" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="22" value="定义每篇文章的信息" style="variable" parent="1" vertex="1">
      <mxGeometry x="510" y="160" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;定义每篇文章的信息&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;variable-name&quot;:[&quot;articleDate&quot;,&quot;articalAbstract&quot;,&quot;articalUrl&quot;,&quot;articalTitle&quot;,&quot;articalauthor&quot;,&quot;doi&quot;],&quot;variable-description&quot;:[&quot;发布日期&quot;,&quot;简介&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;],&quot;loopCount&quot;:&quot;&quot;,&quot;variable-value&quot;:[&quot;${articles[index].OnlineSinceDate}&quot;,&quot;${articles[index].OnlineSinceDate}&quot;,&quot;${articles[index].Url}&quot;,&quot;${articles[index].Title}&quot;,&quot;${json.stringify(articles[index].Authors)}&quot;,&quot;${articles[index].DOI}&quot;],&quot;shape&quot;:&quot;variable&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="24" value="" style="strokeWidth=2;strokeColor=black;sharp=1;" parent="1" source="17" target="22" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="25" value="输出" style="output" parent="1" vertex="1">
      <mxGeometry x="510" y="240" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;输出&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;datasourceId&quot;:&quot;4c05381d67a342390df8b0847a1275c4&quot;,&quot;tableName&quot;:&quot;artical_literature&quot;,&quot;csvName&quot;:&quot;C:/Users/18752/Desktop/新建文本文档 (2)&quot;,&quot;csvEncoding&quot;:&quot;UTF-8&quot;,&quot;output-name&quot;:[&quot;article_date&quot;,&quot;artical_abstract&quot;,&quot;artical_url&quot;,&quot;artical_title&quot;,&quot;batch&quot;,&quot;artical_type&quot;,&quot;artical_author&quot;,&quot;doi&quot;],&quot;loopCount&quot;:&quot;&quot;,&quot;output-value&quot;:[&quot;${articleDate}&quot;,&quot;${articalAbstract}&quot;,&quot;${articalUrl}&quot;,&quot;${articalTitle}&quot;,&quot;${date.format(date.now(),&#39;yyyy-MM-dd&#39;)}&quot;,&quot;frontiers_in_immunology&quot;,&quot;${articalauthor}&quot;,&quot;${doi}&quot;],&quot;output-all&quot;:&quot;1&quot;,&quot;output-database&quot;:&quot;0&quot;,&quot;output-csv&quot;:&quot;0&quot;,&quot;shape&quot;:&quot;output&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="26" value="" style="strokeWidth=2;sharp=1;" parent="1" source="22" target="25" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="27" value="循环" style="loop" parent="1" vertex="1">
      <mxGeometry x="90" y="130" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;循环&quot;,&quot;loopItem&quot;:&quot;&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;loopCount&quot;:&quot;5&quot;,&quot;loopStart&quot;:&quot;0&quot;,&quot;loopEnd&quot;:&quot;-1&quot;,&quot;shape&quot;:&quot;loop&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="28" value="" style="strokeWidth=2;sharp=1;" parent="1" source="2" target="27" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="32" value="开始抓取" style="request" parent="1" vertex="1">
      <mxGeometry x="230" y="80" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;开始抓取&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;method&quot;:&quot;POST&quot;,&quot;sleep&quot;:&quot;&quot;,&quot;timeout&quot;:&quot;&quot;,&quot;response-charset&quot;:&quot;&quot;,&quot;retryCount&quot;:&quot;&quot;,&quot;retryInterval&quot;:&quot;&quot;,&quot;body-type&quot;:&quot;form-data&quot;,&quot;body-content-type&quot;:&quot;text/plain&quot;,&quot;parameter-form-name&quot;:[&quot;JournalId&quot;,&quot;SectionId&quot;,&quot;FromDate&quot;,&quot;ToDate&quot;,&quot;SortType&quot;],&quot;parameter-form-type&quot;:[&quot;text&quot;,&quot;text&quot;,&quot;text&quot;,&quot;text&quot;,&quot;text&quot;],&quot;parameter-form-description&quot;:[&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;],&quot;loopCount&quot;:&quot;&quot;,&quot;url&quot;:&quot;https://www.frontiersin.org/api/journals/article/filter?index=${item}&quot;,&quot;proxy&quot;:&quot;&quot;,&quot;request-body&quot;:&quot;&quot;,&quot;parameter-form-filename&quot;:[&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;],&quot;parameter-form-value&quot;:[&quot;276&quot;,&quot;0&quot;,&quot;&quot;,&quot;&quot;,&quot;recentdate&quot;],&quot;follow-redirect&quot;:&quot;1&quot;,&quot;tls-validate&quot;:&quot;1&quot;,&quot;cookie-auto-set&quot;:&quot;1&quot;,&quot;repeat-enable&quot;:&quot;0&quot;,&quot;shape&quot;:&quot;request&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="33" value="" style="strokeWidth=2;sharp=1;" parent="1" source="27" target="32" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="34" value="" style="strokeWidth=2;sharp=1;" parent="1" source="32" target="15" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
  </root>
</mxGraphModel>

---------------------这是第二个 先启动第一个,再启动第二个,然后就会一直在while的地方卡住,debug看下来是queue中的Future的isDone都为false,导致选不出max max的值为Optional.empty

平台最大线程数 spider.thread.max=4 #单任务默认最大线程数 spider.thread.default=2 #设置为true时定时任务才生效 spider.job.enable=true 这个是线程的配置 环境是windows10 idea2021.1.3x64 jdk8

首先说明的是:这不是 bug。简单说一下机制:每个流程都会启动两个线程工作,一个线程阻塞等待结果,一个线程用来调度,因此如果你同时启动两个流程,至少要保证最大线程数的限制大于 4。你可以试着将最大限制调整成 5 再尝试一下。

可以了,谢谢大佬,然后有对应的群吗?想加群,也想了解下您的新项目slime

nekolr commented 2 years ago
<mxGraphModel>
  <root>
    <mxCell id="0">
      <JsonProperty as="data">
        {&quot;spiderName&quot;:&quot;文献爬虫healio&quot;,&quot;submit-strategy&quot;:&quot;random&quot;,&quot;threadCount&quot;:&quot;&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="1" parent="0"/>
    <mxCell id="2" value="开始" style="start" parent="1" vertex="1">
      <mxGeometry x="10" y="80" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;shape&quot;:&quot;start&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="11" value="开始抓取" style="request" parent="1" vertex="1">
      <mxGeometry x="200" y="80" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;开始抓取&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;method&quot;:&quot;GET&quot;,&quot;sleep&quot;:&quot;5000&quot;,&quot;timeout&quot;:&quot;5000&quot;,&quot;response-charset&quot;:&quot;&quot;,&quot;retryCount&quot;:&quot;&quot;,&quot;retryInterval&quot;:&quot;&quot;,&quot;body-type&quot;:&quot;none&quot;,&quot;body-content-type&quot;:&quot;text/plain&quot;,&quot;loopCount&quot;:&quot;&quot;,&quot;url&quot;:&quot;https://www.healio.com/h5news/specialtylanding/searchjson?page=${item+1}&amp;pageId={A2F15EEF-2C14-40FC-A9C5-F54E929EEFD8}&quot;,&quot;proxy&quot;:&quot;&quot;,&quot;request-body&quot;:&quot;&quot;,&quot;follow-redirect&quot;:&quot;1&quot;,&quot;tls-validate&quot;:&quot;1&quot;,&quot;cookie-auto-set&quot;:&quot;1&quot;,&quot;repeat-enable&quot;:&quot;0&quot;,&quot;shape&quot;:&quot;request&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="15" value="定义变量" style="variable" parent="1" vertex="1">
      <mxGeometry x="360" y="80" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;定义变量&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;variable-name&quot;:[&quot;cards&quot;,&quot;titleList&quot;],&quot;variable-description&quot;:[&quot;&quot;,&quot;&quot;],&quot;loopCount&quot;:&quot;&quot;,&quot;variable-value&quot;:[&quot;${json.parse(resp.html).cards}&quot;,&quot;${json.parse(resp.html).cards}&quot;],&quot;shape&quot;:&quot;variable&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="16" value="" style="strokeWidth=2;sharp=1;" parent="1" source="11" target="15" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="17" value="循环" style="loop" parent="1" vertex="1">
      <mxGeometry x="510" y="80" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;循环&quot;,&quot;loopItem&quot;:&quot;&quot;,&quot;loopVariableName&quot;:&quot;index&quot;,&quot;loopCount&quot;:&quot;${list.length(cards)}&quot;,&quot;loopStart&quot;:&quot;0&quot;,&quot;loopEnd&quot;:&quot;-1&quot;,&quot;shape&quot;:&quot;loop&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="18" value="" style="strokeWidth=2;sharp=1;" parent="1" source="15" target="17" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="22" value="定义每篇文章的信息" style="variable" parent="1" vertex="1">
      <mxGeometry x="510" y="160" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;定义每篇文章的信息&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;variable-name&quot;:[&quot;articleDate&quot;,&quot;articalAbstract&quot;,&quot;articalUrl&quot;,&quot;articalTitle&quot;],&quot;variable-description&quot;:[&quot;发布日期&quot;,&quot;简介&quot;,&quot;&quot;,&quot;&quot;],&quot;loopCount&quot;:&quot;&quot;,&quot;variable-value&quot;:[&quot;${cards[index].PostedDate}&quot;,&quot;${cards[index].FirstParagraph}&quot;,&quot;https://www.healio.com${cards[index].Link}&quot;,&quot;${cards[index].Title}&quot;],&quot;shape&quot;:&quot;variable&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="24" value="" style="strokeWidth=2;strokeColor=blue;sharp=1;" parent="1" source="17" target="22" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;blue&quot;,&quot;condition&quot;:&quot;${cards[index].Link != null}&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="27" value="循环" style="loop" parent="1" vertex="1">
      <mxGeometry x="90" y="130" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;循环&quot;,&quot;loopItem&quot;:&quot;&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;loopCount&quot;:&quot;4&quot;,&quot;loopStart&quot;:&quot;0&quot;,&quot;loopEnd&quot;:&quot;-1&quot;,&quot;shape&quot;:&quot;loop&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="28" value="" style="strokeWidth=2;sharp=1;" parent="1" source="2" target="27" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="29" value="" style="strokeWidth=2;sharp=1;" parent="1" source="27" target="11" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="30" value="输出" style="output" parent="1" vertex="1">
      <mxGeometry x="630" y="160" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;输出&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;datasourceId&quot;:&quot;4c05381d67a342390df8b0847a1275c4&quot;,&quot;tableName&quot;:&quot;artical_literature&quot;,&quot;csvName&quot;:&quot;C:/Users/18752/Desktop/新建文本文档 (2)&quot;,&quot;csvEncoding&quot;:&quot;UTF-8&quot;,&quot;output-name&quot;:[&quot;article_date&quot;,&quot;artical_abstract&quot;,&quot;artical_url&quot;,&quot;artical_title&quot;,&quot;batch&quot;,&quot;artical_type&quot;],&quot;loopCount&quot;:&quot;&quot;,&quot;output-value&quot;:[&quot;${articleDate}&quot;,&quot;${articalAbstract}&quot;,&quot;${articalUrl}&quot;,&quot;${articalTitle}&quot;,&quot;${date.format(date.now(),&#39;yyyy-MM-dd&#39;)}&quot;,&quot;healio&quot;],&quot;output-all&quot;:&quot;1&quot;,&quot;output-database&quot;:&quot;0&quot;,&quot;output-csv&quot;:&quot;0&quot;,&quot;shape&quot;:&quot;output&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="31" value="" style="strokeWidth=2;sharp=1;" parent="1" source="22" target="30" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
  </root>
</mxGraphModel>

这是第一个-------------------------------------------------------------

<mxGraphModel>
  <root>
    <mxCell id="0">
      <JsonProperty as="data">
        {&quot;spiderName&quot;:&quot;文献爬虫frontiers_in_immunology&quot;,&quot;submit-strategy&quot;:&quot;random&quot;,&quot;threadCount&quot;:&quot;&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="1" parent="0"/>
    <mxCell id="2" value="开始" style="start" parent="1" vertex="1">
      <mxGeometry x="10" y="80" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;shape&quot;:&quot;start&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="15" value="定义变量" style="variable" parent="1" vertex="1">
      <mxGeometry x="360" y="80" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;定义变量&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;variable-name&quot;:[&quot;articles&quot;],&quot;variable-description&quot;:[&quot;&quot;],&quot;loopCount&quot;:&quot;&quot;,&quot;variable-value&quot;:[&quot;${json.parse(resp.html).ArticleCollection.Articles}&quot;],&quot;shape&quot;:&quot;variable&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="17" value="循环" style="loop" parent="1" vertex="1">
      <mxGeometry x="510" y="80" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;循环&quot;,&quot;loopItem&quot;:&quot;&quot;,&quot;loopVariableName&quot;:&quot;index&quot;,&quot;loopCount&quot;:&quot;${list.length(articles)}&quot;,&quot;loopStart&quot;:&quot;0&quot;,&quot;loopEnd&quot;:&quot;-1&quot;,&quot;shape&quot;:&quot;loop&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="18" value="" style="strokeWidth=2;sharp=1;" parent="1" source="15" target="17" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="22" value="定义每篇文章的信息" style="variable" parent="1" vertex="1">
      <mxGeometry x="510" y="160" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;定义每篇文章的信息&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;variable-name&quot;:[&quot;articleDate&quot;,&quot;articalAbstract&quot;,&quot;articalUrl&quot;,&quot;articalTitle&quot;,&quot;articalauthor&quot;,&quot;doi&quot;],&quot;variable-description&quot;:[&quot;发布日期&quot;,&quot;简介&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;],&quot;loopCount&quot;:&quot;&quot;,&quot;variable-value&quot;:[&quot;${articles[index].OnlineSinceDate}&quot;,&quot;${articles[index].OnlineSinceDate}&quot;,&quot;${articles[index].Url}&quot;,&quot;${articles[index].Title}&quot;,&quot;${json.stringify(articles[index].Authors)}&quot;,&quot;${articles[index].DOI}&quot;],&quot;shape&quot;:&quot;variable&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="24" value="" style="strokeWidth=2;strokeColor=black;sharp=1;" parent="1" source="17" target="22" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="25" value="输出" style="output" parent="1" vertex="1">
      <mxGeometry x="510" y="240" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;输出&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;datasourceId&quot;:&quot;4c05381d67a342390df8b0847a1275c4&quot;,&quot;tableName&quot;:&quot;artical_literature&quot;,&quot;csvName&quot;:&quot;C:/Users/18752/Desktop/新建文本文档 (2)&quot;,&quot;csvEncoding&quot;:&quot;UTF-8&quot;,&quot;output-name&quot;:[&quot;article_date&quot;,&quot;artical_abstract&quot;,&quot;artical_url&quot;,&quot;artical_title&quot;,&quot;batch&quot;,&quot;artical_type&quot;,&quot;artical_author&quot;,&quot;doi&quot;],&quot;loopCount&quot;:&quot;&quot;,&quot;output-value&quot;:[&quot;${articleDate}&quot;,&quot;${articalAbstract}&quot;,&quot;${articalUrl}&quot;,&quot;${articalTitle}&quot;,&quot;${date.format(date.now(),&#39;yyyy-MM-dd&#39;)}&quot;,&quot;frontiers_in_immunology&quot;,&quot;${articalauthor}&quot;,&quot;${doi}&quot;],&quot;output-all&quot;:&quot;1&quot;,&quot;output-database&quot;:&quot;0&quot;,&quot;output-csv&quot;:&quot;0&quot;,&quot;shape&quot;:&quot;output&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="26" value="" style="strokeWidth=2;sharp=1;" parent="1" source="22" target="25" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="27" value="循环" style="loop" parent="1" vertex="1">
      <mxGeometry x="90" y="130" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;循环&quot;,&quot;loopItem&quot;:&quot;&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;loopCount&quot;:&quot;5&quot;,&quot;loopStart&quot;:&quot;0&quot;,&quot;loopEnd&quot;:&quot;-1&quot;,&quot;shape&quot;:&quot;loop&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="28" value="" style="strokeWidth=2;sharp=1;" parent="1" source="2" target="27" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="32" value="开始抓取" style="request" parent="1" vertex="1">
      <mxGeometry x="230" y="80" width="32" height="32" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;开始抓取&quot;,&quot;loopVariableName&quot;:&quot;&quot;,&quot;method&quot;:&quot;POST&quot;,&quot;sleep&quot;:&quot;&quot;,&quot;timeout&quot;:&quot;&quot;,&quot;response-charset&quot;:&quot;&quot;,&quot;retryCount&quot;:&quot;&quot;,&quot;retryInterval&quot;:&quot;&quot;,&quot;body-type&quot;:&quot;form-data&quot;,&quot;body-content-type&quot;:&quot;text/plain&quot;,&quot;parameter-form-name&quot;:[&quot;JournalId&quot;,&quot;SectionId&quot;,&quot;FromDate&quot;,&quot;ToDate&quot;,&quot;SortType&quot;],&quot;parameter-form-type&quot;:[&quot;text&quot;,&quot;text&quot;,&quot;text&quot;,&quot;text&quot;,&quot;text&quot;],&quot;parameter-form-description&quot;:[&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;],&quot;loopCount&quot;:&quot;&quot;,&quot;url&quot;:&quot;https://www.frontiersin.org/api/journals/article/filter?index=${item}&quot;,&quot;proxy&quot;:&quot;&quot;,&quot;request-body&quot;:&quot;&quot;,&quot;parameter-form-filename&quot;:[&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;],&quot;parameter-form-value&quot;:[&quot;276&quot;,&quot;0&quot;,&quot;&quot;,&quot;&quot;,&quot;recentdate&quot;],&quot;follow-redirect&quot;:&quot;1&quot;,&quot;tls-validate&quot;:&quot;1&quot;,&quot;cookie-auto-set&quot;:&quot;1&quot;,&quot;repeat-enable&quot;:&quot;0&quot;,&quot;shape&quot;:&quot;request&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="33" value="" style="strokeWidth=2;sharp=1;" parent="1" source="27" target="32" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
    <mxCell id="34" value="" style="strokeWidth=2;sharp=1;" parent="1" source="32" target="15" edge="1">
      <mxGeometry relative="1" as="geometry"/>
      <JsonProperty as="data">
        {&quot;value&quot;:&quot;&quot;,&quot;exception-flow&quot;:&quot;0&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;line-style&quot;:&quot;sharp&quot;,&quot;lineColor&quot;:&quot;black&quot;,&quot;condition&quot;:&quot;&quot;,&quot;transmit-variable&quot;:&quot;1&quot;}
      </JsonProperty>
    </mxCell>
  </root>
</mxGraphModel>

---------------------这是第二个 先启动第一个,再启动第二个,然后就会一直在while的地方卡住,debug看下来是queue中的Future的isDone都为false,导致选不出max max的值为Optional.empty

平台最大线程数 spider.thread.max=4 #单任务默认最大线程数 spider.thread.default=2 #设置为true时定时任务才生效 spider.job.enable=true 这个是线程的配置 环境是windows10 idea2021.1.3x64 jdk8

首先说明的是:这不是 bug。简单说一下机制:每个流程都会启动两个线程工作,一个线程阻塞等待结果,一个线程用来调度,因此如果你同时启动两个流程,至少要保证最大线程数的限制大于 4。你可以试着将最大限制调整成 5 再尝试一下。

可以了,谢谢大佬,然后有对应的群吗?想加群,也想了解下您的新项目slime

群你可以在 issue 里边找找,不过好像加不了了,我不是管理员,不太清楚。还有就是 slime 并不算新项目,只是对 spider-flow 的精简和重构,方便开箱即用和服务端部署的。