https://builderbot.vercel.app/_next/static/chunks/pages/es/showcases/queue-limit-58f5b8dab72d699b.js
1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[61],{16840:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/es/showcases/queue-limit",function(){return t(58990)}])},58990:function(e,n,t){"use strict";t.r(n),t.d(n,{__N_SSG:function(){return c},default:function(){return MDXContent}});var r=t(97997),o=t(11151),a=t(65928),s=t(38706),i=t(99686),l=t(86156);function _createMdxContent(e){let n={code:"code",h1:"h1",h2:"h2",hr:"hr",p:"p",pre:"pre",strong:"strong",...(0,o.ah)(),...e.components},{Properties:t,Property:c}=n;return t||_missingMdxReference("Properties",!0),c||_missingMdxReference("Property",!0),(0,r.BX)(r.HY,{children:[(0,r.tZ)(n.h1,{children:"Queue"}),"\n",(0,r.tZ)(n.h2,{id:"how-to-implement-and-manage-queue-limit",children:"How to implement and manage Queue Limit",not:"true"}),"\n",(0,r.tZ)(n.p,{children:"El marco implementa de forma predeterminada un administrador de colas basado en promesas de trabajo por usuario.\nSi ya entiendes el concepto y te encuentras en un entorno donde recibes una cantidad considerable de mensajes recurrentes en un corto per\xedodo de tiempo y notas que responde a una gran cantidad de usuarios pero no a todos. Puede intentar extender la configuraci\xf3n de la cola de procesos."}),"\n",(0,r.BX)(n.p,{children:[(0,r.tZ)(n.strong,{children:"Imagine el caso"})," en el que recibe m\xe1s de 60 mensajes de m\xe1s de 60 personas en un per\xedodo de tiempo muy corto de menos de 20 segundos, por ejemplo"]}),"\n",(0,r.tZ)(a.G,{chart:`flowchart LR 2 n(User n) -.-> B((Bot)) 3 n(User n) -.-> B((Bot)) 4 n(User n) -.-> B((Bot)) 5 n(User n) -.-> B((Bot)) 6 n(User n) -.-> B((Bot)) 7 n(User n) -.-> B((Bot)) 8 n(User n) -.-> B((Bot))`}),"\n",(0,r.tZ)(n.p,{children:"Es muy probable que no responda a todos los usuarios, ya que la configuraci\xf3n predeterminada del bot est\xe1 configurada para manejar una cantidad menor de procesos, pero es muy f\xe1cil de modificar."}),"\n",(0,r.tZ)(n.pre,{language:"bash",code:"const main = async () => {\n\n await createBot({\n database: new MemoryDB(),\n provider: createProvider(BaileysProvider),\n flow: createFlow([...])\n }, {\n queue: {\n timeout: 20000, //\uD83D\uDC4C\n concurrencyLimit: 50 //\uD83D\uDC4C\n }\n })\n}\n",children:(0,r.tZ)(n.code,{className:"language-bash",children:'<span><span style="color: var(--shiki-token-function)">const</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">main</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">=</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">async</span><span style="color: var(--shiki-color-text)"> () => {</span></span>\n<span></span>\n<span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-function)">await</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">createBot</span><span style="color: var(--shiki-color-text)">({</span></span>\n<span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-function)">database:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">new</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">MemoryDB</span><span style="color: var(--shiki-color-text)">()</span><span style="color: var(--shiki-token-string)">,</span></span>\n<span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-function)">provider:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">createProvider</span><span style="color: var(--shiki-color-text)">(</span><span style="color: var(--shiki-token-function)">BaileysProvider</span><span style="color: var(--shiki-color-text)">)</span><span style="color: var(--shiki-token-string)">,</span></span>\n<span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-function)">flow:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">createFlow</span><span style="color: var(--shiki-color-text)">([...])</span></span>\n<span><span style="color: var(--shiki-color-text)"> }, {</span></span>\n<span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-function)">queue:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">{</span></span>\n<span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-function)">timeout:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-constant)">20000</span><span style="color: var(--shiki-token-string)">,</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">//\uD83D\uDC4C</span></span>\n<span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-function)">concurrencyLimit:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-constant)">50</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">//\uD83D\uDC4C</span></span>\n<span><span style="color: var(--shiki-color-text)"> }</span></span>\n<span><span style="color: var(--shiki-color-text)"> })</span></span>\n<span><span style="color: var(--shiki-color-text)">}</span></span>\n<span></span>'}),title:"app.ts"}),"\n",(0,r.tZ)(n.hr,{}),"\n",(0,r.BX)(t,{children:[(0,r.tZ)(c,{name:"timeout",type:"number",children:(0,r.BX)(n.p,{children:["N\xfamero de milisegundos utilizados como duraci\xf3n m\xe1xima para la ejecuci\xf3n de una funci\xf3n as\xedncrona. ",(0,r.tZ)(n.strong,{children:"default 20000"})]})}),(0,r.tZ)(c,{name:"concurrencyLimit",type:"number",children:(0,r.BX)(n.p,{children:["N\xfamero de procesos paralelos que puede ejecutar al mismo tiempo. ",(0,r.tZ)(n.strong,{children:"default 15"})]})})]}),"\n",(0,r.tZ)(n.hr,{}),"\n",(0,r.tZ)(l.t,{}),"\n",(0,r.tZ)(i._,{}),"\n",(0,r.tZ)(s.T,{users:["leifermendez","robmoncayonabux","elimeleth"]})]})}var c=!0;function MDXContent(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}={...(0,o.ah)(),...e.components};return n?(0,r.tZ)(n,{...e,children:(0,r.tZ)(_createMdxContent,{...e})}):_createMdxContent(e)}function _missingMdxReference(e,n){throw Error("Expected "+(n?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}},38706:function(e,n,t){"use strict";t.d(n,{T:function(){return Contributors}});var r=t(97997),o=t(11720),a=t(25675),s=t.n(a),i=t(93077);let l=(0,i.createCache)((0,i.memoryStore)(),{max:100,ttl:864e5,ttlAutopurge:!0}),getProfiles=async function(){let e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];n=n.map(e=>e.toLowerCase());let fetchUser=async e=>{let n=await l.get(`contributors-${e}`);if(n)return n;let t=await fetch(`https://api.github.com/users/${e}`,{next:{revalidate:3600}});if(!t.ok)throw Error(`Failed to fetch GitHub user: ${e}`);let r=await t.json();return await l.set(`contributors-${e}`,r,864e5),r};e=await Promise.all(n.map(async e=>{try{let n=await fetchUser(e);return{id:n.id,name:n.login.toLowerCase(),avatar:n.avatar_url,profile:n.html_url,contributions:n.contributions}}catch(e){return console.error(e.message),null}}));let t=e.filter(e=>null!==e);return t};function Contributors(e){let{users:n,mode:t}=e,[a,i]=(0,o.useState)([]);return((0,o.useEffect)(()=>{(async function(){try{let e=await getProfiles(n);i(e)}catch(e){console.error("Error fetching profiles:",e)}})()},[]),a.length)?(0,r.tZ)("div",{className:"place-content-center",children:(0,r.tZ)("ul",{className:"flex flex-wrap gap-2 p-0 m-0",children:a.map(e=>(0,r.BX)("li",{className:"list-none p-0 m-0 flex gap-2 bg-gray-100 dark:bg-white/2.5 dark:ring-1 dark:ring-white/10 rounded-2xl",children:[(0,r.tZ)("a",{href:e.profile,target:"_blank",children:(0,r.tZ)(s(),{src:e.avatar,alt:e.name,width:30,height:30,className:"rounded-full hover:shadow-md transition-all shadow-slate-400 m-0 bg-fuchsia-200"})}),t?(0,r.tZ)("span",{className:"lowercase mr-3",children:e.name}):(0,r.tZ)(r.HY,{})]},"contributor-"+e.id))})}):(0,r.tZ)("div",{className:"min-h-[30px]"})}},86049:function(e,n,t){"use strict";t.d(n,{K:function(){return GridPattern}});var r=t(97997),o=t(11720);function GridPattern(e){let{width:n,height:t,x:a,y:s,squares:i,...l}=e,c=(0,o.useId)();return(0,r.BX)("svg",{"aria-hidden":"true",...l,children:[(0,r.tZ)("defs",{children:(0,r.tZ)("pattern",{id:c,width:n,height:t,patternUnits:"userSpaceOnUse",x:a,y:s,children:(0,r.tZ)("path",{d:`M.5 ${t}V.5H${n}`,fill:"none"})})}),(0,r.tZ)("rect",{width:"100%",height:"100%",strokeWidth:0,fill:`url(#${c})`}),i&&(0,r.tZ)("svg",{x:a,y:s,className:"overflow-visible",children:i.map(e=>{let[o,a]=e;return(0,r.tZ)("rect",{strokeWidth:"0",width:n+1,height:t+1,x:o*n,y:a*t},`${o}-${a}`)})})]})}},86156:function(e,n,t){"use strict";t.d(n,{t:function(){return Guides}});var r=t(97997),o=t(5682),a=t(68289);let s=[{href:"/uses-cases#my-first-bot",name:"My first chatbot",description:"Learn how build your first chatbot in few minutes"},{href:"/concepts",name:"Concepts",description:"Understand the essential concepts for building bots"},{href:"/add-functions",name:"Add Functions",description:"The key to learning how to write flows is add-functions."},{href:"/plugins",name:"Plugins",description:"Unlimitate and start implementing the community plugins."}];function Guides(){return(0,r.BX)("div",{className:"my-16 xl:max-w-none",children:[(0,r.tZ)(a.X,{level:2,id:"guides",children:"Guides"}),(0,r.tZ)("div",{className:"not-prose mt-4 grid grid-cols-1 gap-8 border-zinc-900/5 pt-10 dark:border-white/5 sm:grid-cols-2 xl:grid-cols-4",children:s.map(e=>(0,r.BX)("div",{children:[(0,r.tZ)("h3",{className:"text-sm font-semibold text-zinc-900 dark:text-white",children:e.name}),(0,r.tZ)("p",{className:"mt-1 text-sm text-zinc-600 dark:text-zinc-400",children:e.description}),(0,r.tZ)("p",{className:"mt-4",children:(0,r.tZ)(o.z,{href:e.href,variant:"text",arrow:"right",children:"Read more"})})]},e.href))})]})}},99686:function(e,n,t){"use strict";t.d(n,{_:function(){return Resources}});var r=t(97997),o=t(41664),a=t.n(o),s=t(65512),i=t(40406);function useMotionTemplate(e,...n){let t=e.length;return(0,s.N)(n.filter(i.i),function(){let r="";for(let o=0;o<t;o++){r+=e[o];let t=n[o];t&&(r+=(0,i.i)(t)?t.get():t)}return r})}var l=t(50508),c=t(4960),d=t(86049),p=t(68289);let u=[{href:"/showcases/modularize",name:"Modularize",description:"Learn how to modularise flows so that you can have a more maintainable bot.",icon:function(e){return(0,r.BX)("svg",{viewBox:"0 0 20 20","aria-hidden":"true",...e,children:[(0,r.tZ)("path",{strokeWidth:"0",fillRule:"evenodd",clipRule:"evenodd",d:"M10 .5a9.5 9.5 0 0 1 5.598 17.177C14.466 15.177 12.383 13.5 10 13.5s-4.466 1.677-5.598 4.177A9.5 9.5 0 0 1 10 .5ZM12.5 8a2.5 2.5 0 1 0-5 0 2.5 2.5 0 0 0 5 0Z"}),(0,r.tZ)("path",{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",d:"M10 .5a9.5 9.5 0 0 1 5.598 17.177A9.458 9.458 0 0 1 10 19.5a9.458 9.458 0 0 1-5.598-1.823A9.5 9.5 0 0 1 10 .5Z"}),(0,r.tZ)("path",{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",d:"M4.402 17.677C5.534 15.177 7.617 13.5 10 13.5s4.466 1.677 5.598 4.177M10 5.5a2.5 2.5 0 1 1 0 5 2.5 2.5 0 0 1 0-5Z"})]})},pattern:{y:16,squares:[[0,1],[1,3]]}},{href:"/tutorials/api-use",name:"Send Message",description:"How to send a message via HTTP to start conversations, you can send multimedia as well.",icon:function(e){return(0,r.BX)("svg",{viewBox:"0 0 20 20","aria-hidden":"true",...e,children:[(0,r.tZ)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 16.5c4.142 0 7.5-3.134 7.5-7s-3.358-7-7.5-7c-4.142 0-7.5 3.134-7.5 7 0 1.941.846 3.698 2.214 4.966L3.5 17.5c2.231 0 3.633-.553 4.513-1.248A8.014 8.014 0 0 0 10 16.5Z"}),(0,r.tZ)("path",{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 8.5h5M8.5 11.5h3"})]})},pattern:{y:-6,squares:[[-1,2],[1,3]]}},{href:"/deploy/docker",name:"Dockerizer",description:"A good practice is to dockerise your bots to make them more maintainable and effective.",icon:function(e){return(0,r.BX)("svg",{viewBox:"0 0 20 20","aria-hidden":"true",...e,children:[(0,r.tZ)("path",{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",d:"M2.5 5.5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v8a3 3 0 0 1-3 3h-9a3 3 0 0 1-3-3v-8Z"}),(0,r.tZ)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 10 4.526 5.256c-.7-.607-.271-1.756.655-1.756h9.638c.926 0 1.355 1.15.655 1.756L10 10Z"})]})},pattern:{y:32,squares:[[0,2],[1,4]]}},{href:"/events",name:"Events",description:"Learning about events will make us more fluent when creating chatbots.",icon:function(e){return(0,r.BX)("svg",{viewBox:"0 0 20 20","aria-hidden":"true",...e,children:[(0,r.tZ)("path",{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",d:"M10.046 16H1.955a.458.458 0 0 1-.455-.459C1.5 13.056 3.515 11 6 11h.5"}),(0,r.tZ)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 15.454C7.5 12.442 9.988 10 13 10s5.5 2.442 5.5 5.454a.545.545 0 0 1-.546.546H8.045a.545.545 0 0 1-.545-.546Z"}),(0,r.tZ)("path",{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",d:"M6.5 4a2 2 0 1 1 0 4 2 2 0 0 1 0-4Z"}),(0,r.tZ)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 2a2.5 2.5 0 1 1 0 5 2.5 2.5 0 0 1 0-5Z"})]})},pattern:{y:22,squares:[[0,1]]}}];function ResourceIcon(e){let{icon:n}=e;return(0,r.tZ)("div",{className:"flex h-7 w-7 items-center justify-center rounded-full bg-zinc-900/5 ring-1 ring-zinc-900/25 backdrop-blur-[2px] transition duration-300 group-hover:bg-white/50 group-hover:ring-zinc-900/25 dark:bg-white/7.5 dark:ring-white/15 dark:group-hover:bg-teal-300/10 dark:group-hover:ring-teal-400",children:(0,r.tZ)(n,{className:"h-5 w-5 fill-zinc-700/10 stroke-zinc-700 transition-colors duration-300 group-hover:stroke-zinc-900 dark:fill-white/10 dark:stroke-zinc-400 dark:group-hover:fill-teal-300/10 dark:group-hover:stroke-teal-400"})})}function ResourcePattern(e){let{mouseX:n,mouseY:t,...o}=e,a=useMotionTemplate`radial-gradient(180px at ${n}px ${t}px, white, transparent)`,s={maskImage:a,WebkitMaskImage:a};return(0,r.BX)("div",{className:"pointer-events-none",children:[(0,r.tZ)("div",{className:"absolute inset-0 rounded-2xl transition duration-300 [mask-image:linear-gradient(white,transparent)] group-hover:opacity-50",children:(0,r.tZ)(d.K,{width:72,height:56,x:"50%",className:"absolute inset-x-0 inset-y-[-30%] h-[160%] w-full skew-y-[-18deg] fill-black/[0.02] stroke-black/5 dark:fill-white/1 dar
8k:stroke-white/2.5",...o})}),(0,r.tZ)(l.E.div,{className:"absolute inset-0 rounded-2xl bg-gradient-to-r from-[#D7EDEA] to-[#F4FBDF] opacity-0 transition duration-300 group-hover:opacity-100 dark:from-[#202D2E] dark:to-[#303428]",style:s}),(0,r.tZ)(l.E.div,{className:"absolute inset-0 rounded-2xl opacity-0 mix-blend-overlay transition duration-300 group-hover:opacity-100",style:s,children:(0,r.tZ)(d.K,{width:72,height:56,x:"50%",className:"absolute inset-x-0 inset-y-[-30%] h-[160%] w-full skew-y-[-18deg] fill-black/50 stroke-black/70 dark:fill-white/2.5 dark:stroke-white/10",...o})})]})}function Resource(e){let{resource:n}=e,t=(0,c.c)(0),o=(0,c.c)(0);return(0,r.BX)("div",{onMouseMove:function(e){let{currentTarget:n,clientX:r,clientY:a}=e,{left:s,top:i}=n.getBoundingClientRect();t.set(r-s),o.set(a-i)},className:"group relative flex rounded-2xl bg-zinc-50 transition-shadow hover:shadow-md hover:shadow-zinc-900/5 dark:bg-white/2.5 dark:hover:shadow-black/5",children:[(0,r.tZ)(ResourcePattern,{...n.pattern,mouseX:t,mouseY:o}),(0,r.tZ)("div",{className:"absolute inset-0 rounded-2xl ring-1 ring-inset ring-zinc-900/7.5 group-hover:ring-zinc-900/10 dark:ring-white/10 dark:group-hover:ring-white/20"}),(0,r.BX)("div",{className:"relative rounded-2xl px-4 pb-4 pt-16",children:[(0,r.tZ)(ResourceIcon,{icon:n.icon}),(0,r.tZ)("h3",{className:"mt-4 text-sm font-semibold leading-7 text-zinc-900 dark:text-white",children:(0,r.BX)(a(),{href:n.href,children:[(0,r.tZ)("span",{className:"absolute inset-0 rounded-2xl"}),n.name]})}),(0,r.tZ)("p",{className:"mt-1 text-sm text-zinc-600 dark:text-zinc-400",children:n.description})]})]},n.href)}function Resources(){return(0,r.BX)("div",{className:"my-16 xl:max-w-none",children:[(0,r.tZ)(p.X,{level:2,id:"resources",children:"Resources"}),(0,r.tZ)("div",{className:"not-prose mt-4 grid grid-cols-1 gap-8 border-zinc-900/5 pt-10 dark:border-white/5 sm:grid-cols-2 xl:grid-cols-4",children:u.map(e=>(0,r.tZ)(Resource,{resource:e},e.href))})]})}}},function(e){e.O(0,[152,3077,9501,2888,179],function(){return e(e.s=16840)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.