Skip to content

Commit

Permalink
ditch bottleneck
Browse files Browse the repository at this point in the history
  • Loading branch information
mciparelli committed Nov 24, 2023
1 parent 384ce12 commit c9b01b0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
22 changes: 15 additions & 7 deletions components/origin-destination-inputs.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useRef } from 'preact/hooks';
import { useRef } from "preact/hooks";
import { filtros } from "utils/flight.js";
import { ArrowPathIcon } from 'icons';
import { ArrowPathIcon } from "icons";
import RegionsDropdown from "./regions-dropdown.jsx";

export default function OriginDestinationInputs({ defaults, searchType }) {
Expand Down Expand Up @@ -56,11 +56,19 @@ export default function OriginDestinationInputs({ defaults, searchType }) {
autoFocus
/>
)}
{"airports" === searchType && <button type="button" class="px-2"><ArrowPathIcon class="h-5 w-5" aria-hidden="true" onClick={() => {
const currentOrigin = originRef.current.value;
originRef.current.value = destinationRef.current.value;
destinationRef.current.value = currentOrigin;
}} /></button>}
{"airports" === searchType && (
<button type="button" class="px-2">
<ArrowPathIcon
class="h-5 w-5"
aria-hidden="true"
onClick={() => {
const currentOrigin = originRef.current.value;
originRef.current.value = destinationRef.current.value;
destinationRef.current.value = currentOrigin;
}}
/>
</button>
)}
</fieldset>
);
}
1 change: 0 additions & 1 deletion deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"icons": "https://esm.sh/@heroicons/[email protected]/24/solid?alias=react:preact/compat&exports=ArrowPathIcon,CheckIcon,ChevronUpIcon,ChevronDownIcon,ChevronUpDownIcon,InformationCircleIcon",
"react-confetti-explosion": "https://esm.sh/react-confetti-explosion?alias=react:preact/compat,react-dom:preact/compat,@types/react:preact/compat&external=preact",
"fetch-retry": "https://esm.sh/fetch-retry",
"bottleneck": "https://esm.sh/bottleneck",
"swr": "https://esm.sh/swr?alias=react:preact/compat&external=preact",
"components/": "./components/",
"utils/": "./utils/",
Expand Down
9 changes: 2 additions & 7 deletions utils/smiles-api.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import FetchRetry from "fetch-retry";
import Bottleneck from "bottleneck";
// import { effect } from "@preact/signals";
import { tripTypes } from "./flight.js";
import {
Expand All @@ -8,17 +7,13 @@ import {
requestsSignal,
} from "./signals.js";

const limiter = new Bottleneck({
maxConcurrent: 20,
});

// effect(() => {
// limiter.updateSettings({
// maxConcurrent: concurrencySignal.value,
// });
// });

const fetch = limiter.wrap(FetchRetry(globalThis.fetch, {
const fetch = FetchRetry(globalThis.fetch, {
retryDelay: function (attempt, _error, _response) {
return Math.pow(2, attempt) * 1000;
},
Expand All @@ -40,7 +35,7 @@ const fetch = limiter.wrap(FetchRetry(globalThis.fetch, {
return true;
}
},
}));
});

const defaultParams = {
adults: "1",
Expand Down

2 comments on commit c9b01b0

@deno-deploy
Copy link

@deno-deploy deno-deploy bot commented on c9b01b0 Nov 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failed to deploy:

HTTP status server error (500 Internal Server Error) for url (https://esm.sh/v135/@heroicons/[email protected]/X-YS9yZWFjdDpwcmVhY3QvY29tcGF0CnRzL0Fycm93UGF0aEljb24sQ2hlY2tJY29uLENoZXZyb25Eb3duSWNvbixDaGV2cm9uVXBEb3duSWNvbixDaGV2cm9uVXBJY29uLEluZm9ybWF0aW9uQ2lyY2xlSWNvbg/denonext/24/solid/AcademicCapIcon.js)

@deno-deploy
Copy link

@deno-deploy deno-deploy bot commented on c9b01b0 Nov 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failed to deploy:

HTTP status server error (500 Internal Server Error) for url (https://esm.sh/v135/@heroicons/[email protected]/X-YS9yZWFjdDpwcmVhY3QvY29tcGF0CnRzL0Fycm93UGF0aEljb24sQ2hlY2tJY29uLENoZXZyb25Eb3duSWNvbixDaGV2cm9uVXBEb3duSWNvbixDaGV2cm9uVXBJY29uLEluZm9ybWF0aW9uQ2lyY2xlSWNvbg/denonext/24/solid/AcademicCapIcon.js)

Please sign in to comment.