$schedule->command('job:dispatchNow Maintenance\\\\RemoveDuplicates')->monthly();
// WS to Toolbox migration
$schedule->command('ws:migrate --publications=v2 --documents=missing')->dailyAt('1:00');
- $schedule->command('ws:migrate --publications=missing --documents=missing')->everyFifteenMinutes();
+ $schedule->command('ws:migrate --publications=missing --documents=missing')->everyTwoHours();
$schedule->command('fluidbook:quote --reminder')->weekdays()->at('10:00');
}
$schedule->command('fluidbook:farm:ping')->everyMinute();
$schedule->command('cubist:magic:precache')->everyFiveMinutes();
- $schedule->command('toolbox:precache')->everyFifteenMinutes();
+ $schedule->command('toolbox:precache')->everyFiveMinutes();
}
/**
use App\Notifications\ToolboxNotification;
use Cubist\Util\Files\Files;
+use Fluidbook\Tools\Jobs\ProcessFile;
use hollodotme\FastCGI\Client;
use hollodotme\FastCGI\Requests\PostRequest;
use hollodotme\FastCGI\SocketConnections\NetworkSocket;
class Farm
{
- protected static $_forceServer = 'alphaville';
+ protected static $_outPDF = [];
+ protected static $_forceServer = false;
+ //protected static $_forceServer = 'alphaville';
protected static $_farmServers = [
['name' => 'alphaville', 'host' => 'fluidbook-processfarm', 'port' => 9000, 'weight' => 24, 'region' => 'UE'],
['name' => 'brazil', 'host' => 'brazil.cubedesigners.com', 'weight' => 2, 'region' => 'US'],
return self::_getFile($params);
}
- public static function getFileFromPDF($pdf, $page, $format, $resolution, $quality, $withText = true, $withGraphics = true, $version = 'html', $out = null, $force = false, $attemps = 3)
+ protected static function _getOutDirFromPDF($pdf)
{
- if (null === $out) {
+ if (!isset(self::$_outPDF[$pdf])) {
$hash = Files::hashFileAttributes($pdf);
- $out = Files::mkdir(protected_path('fluidbookpublication/cache/pdffiles/' . $hash));
+ self::$_outPDF[$pdf] = Files::mkdir(protected_path('fluidbookpublication/cache/pdffiles/' . $hash));
+ }
+ return self::$_outPDF[$pdf];
+ }
+
+ public static function getFileFromPDF($pdf, $page, $format, $resolution, $quality, $withText = true, $withGraphics = true, $version = 'html', $out = null, $force = false, $attempts = 3)
+ {
+ if (null === $out) {
+ $out = self::_getOutDirFromPDF($pdf);
}
$attrs = ['pdf' => $pdf,
Cache::forget($cachekey);
}
- $res = Cache::rememberForever($cachekey, function () use ($params) {
+ $res = Cache::rememberForever($cachekey, function () use ($params, $out) {
+ $path = $out . ProcessFile::getFilename($params['page'], $params['format'], $params['resolution'], $params['quality'], $params['withGraphics'], $params['withTexts'], $params['version']);
+ if (file_exists($path)) {
+ return $path;
+ }
return self::_getFile($params);
});
- if ((!$res || !file_exists($res))) {
- return self::getFileFromPDF($pdf, $page, $format, $resolution, $quality, $withText, $withGraphics, $version, $out, true, $attemps - 1);
+
+ if ((!$res || !file_exists($res)) && $attempts > 0) {
+ return self::getFileFromPDF($pdf, $page, $format, $resolution, $quality, $withText, $withGraphics, $version, $out, true, $attempts - 1);
}
+
return $res;
}
this.movingRuler = null;
this.rulersMagnetValuesX = [];
this.rulersMagnetValuesY = [];
- this.dividers = [1, 2, 5, 10, 20, 50, 100, 200];
+ this.dividers = [1, 2, 5, 10, 20, 50, 100, 200, 500];
this.init();
}
let visible_w = (this.linkeditor.canvasRect.width / this.linkeditor.fs) / this.linkeditor.zoom.zoom;
let visible_h = (this.linkeditor.canvasRect.height / this.linkeditor.fs) / this.linkeditor.zoom.zoom;
- // Find the best divider to have around 10 main divisions
+ // Find the best divider to have around 12 main divisions
let divider = 0;
for (let d in this.dividers) {
divider = this.dividers[d];
let v = visible_h / divider;
- if (v <= 10) {
+ if (v <= 12) {
break;
}
}