feat: make author clickable
This commit is contained in:
@ -9,7 +9,7 @@ import {
|
||||
import { parseMediaType } from "https://deno.land/std@0.175.0/media_types/parse_media_type.ts";
|
||||
import * as cache from "@lib/cache/image.ts";
|
||||
import { SILVERBULLET_SERVER } from "@lib/env.ts";
|
||||
import { PromiseQueue } from "@lib/promise.ts";
|
||||
import { ConcurrentPromiseQueue, PromiseQueue } from "@lib/promise.ts";
|
||||
import { BadRequestError } from "@lib/errors.ts";
|
||||
import { createLogger } from "@lib/log.ts";
|
||||
|
||||
@ -109,7 +109,7 @@ function parseParams(reqUrl: URL) {
|
||||
};
|
||||
}
|
||||
|
||||
const queue = new PromiseQueue();
|
||||
const queue = new ConcurrentPromiseQueue(2);
|
||||
|
||||
async function processImage(imageUrl: string, params: ImageParams) {
|
||||
const remoteImage = await getRemoteImage(imageUrl);
|
||||
@ -165,20 +165,21 @@ const GET = async (
|
||||
processImage(imageUrl, params)
|
||||
);
|
||||
|
||||
const clonedImage = resizedImage.slice();
|
||||
setTimeout(() => {
|
||||
cache.setImage(resizedImage.slice(), {
|
||||
cache.setImage(clonedImage, {
|
||||
url: imageUrl,
|
||||
width: params.width,
|
||||
height: params.height,
|
||||
mediaType: mediaType,
|
||||
});
|
||||
}, 10);
|
||||
}, 50);
|
||||
|
||||
log.debug("not-cached", { imageUrl });
|
||||
|
||||
cache.getThumbhash({ url: imageUrl }).then((hash) => {
|
||||
cache.getThumbhash({ url: imageUrl }).then(([hash]) => {
|
||||
if (!hash) {
|
||||
cache.createThumbhash(resizedImage.slice(), imageUrl).catch((_err) => {
|
||||
cache.createThumbhash(clonedImage.slice(), imageUrl).catch((_err) => {
|
||||
//
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user